From aa555ba942952279fab4af3cf85f7da432ecd570 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 5 Mar 2019 17:04:39 +0530 Subject: [PATCH 1/2] rental changes --- .../rental-verification.component.html | 564 +++++++++++++--- .../rental-verification.component.scss | 3 +- .../rental-verification.component.ts | 636 +++++++++++++++--- .../manage-pd/manage-pd.module.ts | 3 +- .../pd-pipes/number-to-words.pipe.spec.ts | 8 + .../pd-pipes/number-to-words.pipe.ts | 70 ++ 6 files changed, 1091 insertions(+), 193 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts 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 e8e80f279..e6bbb9a9e 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 @@ -18,11 +18,63 @@ + + Property Details + + +
+ +
+ + Address of the Property + + +
+
+ + + State + + + {{stVal.name}} + + + + + City + + + {{ctVal.city_name}} + + + + + + Pincode + + + {{pinVal.pincode}} + + + +
+ Is Address Validated During Visit ? ( {{_rentalForm.value.validate_visited_address===true ? 'Yes' : 'No'}} ) +
+ + Actual Address Visited + + +
+ +
- Name of the Person who is showing the Property to Sineedge Officer + Name of the Person Who is Showing the Property to Sineedge Officer @@ -36,10 +88,10 @@ Specify Other Person - - Who is {{_rentalForm.controls['other_person_met'].value}} + + Who is {{_rentalForm.controls['other_person_met'].value}} ? + formControlName="other_name_person_showing_property" [compareWith]="compareSingleObjects" (selectionChange)="personShowingChanges(_rentalForm.controls['other_name_person_showing_property'].value)" multiple required> {{pType.name}} @@ -47,8 +99,8 @@ - - Specify Other + + Who is {{_rentalForm.controls['other_person_met'].value}} ? @@ -82,119 +134,445 @@ Relation To - {{relationto.name | titlecase}} + {{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 + + + + No of Floors + + + + Tot No of Units + + +
- - -
- - - Monthly Rent Amount as per Loan Applicant - - {{"₹"}} {{rentAmtInwords}} Only + + + + + + + + Unit {{u+1}} + + + +
+ + + Name of the Tenant(s)/Lessees(s) of the Let out Property + + 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 Cash + + {{"₹"}} {{units.value.amount_received_cash | numberToWords}} Only + + + + Amount Received in Bank + + {{"₹"}} {{units.value.amount_received_bank | numberToWords}} Only + + + Reason for Receiving Multiple Payment Mode + + + + Securtity Deposit amount as per Loan Applicant + + {{"₹"}} {{units.value.securtity_deposit_amount | numberToWords}} Only + + + + + Area Covered by the Property + + + + + + + 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 + - - Mode of Payment of Rent as per Loan Applicant + + + + 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 Rent Agreement + + + + {{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 + formControlName="payment_mode_per_met" [compareWith]="compareSingleObjects" (selectionChange)="generatePaymentOptions(units.value,u,2)" required> {{payment.name}} - + Amount Received in Cash - - {{"₹"}} {{amountReceivedCash}} Only + + {{"₹"}} {{units.value.amount_received_cash_per_met | numberToWords}} Only - + Amount Received in Bank - - {{"₹"}} {{amountReceivedBank}} Only + + {{"₹"}} {{units.value.amount_received_bank_per_met | numberToWords}} Only - - Payment Received Reason - + + Reason for Receiving Multiple Payment Mode + - - Securtity Deposit amount as per Loan Applicant - - {{"₹"}} {{securtityDepositAmount}} Only - - - -
-
-
+ + + + What is the Reason for Difference in Rent Amount or Mode of Payment + + + + + +
+ +
+ + + +
+ +
+
+ +
+
+ + + + + + Third Party Check + +
- - - Nature of Let Out property as per Loan Applicant - - - {{property.name}} - + + + Third party check done on prevailing rent in the area + + Yes + No - - - Other Property - - - - - - - Type of Units as per Loan Applicants - - - - {{unit.name}} - - - - - - Other Units - - - - No Floor - - -
-
-
- - Floor Level - - - - - No of Units on the Floor - - -
-
-
- +
- + + 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 + + + + + + - -
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 183e27284..2fd9cea87 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 @@ -9,5 +9,6 @@ justify-content: center !important; } .align-margin { - margin-left: 25%; + margin-left: 4%; + margin-right: 4%; } 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 c186fea7e..8f716ffc3 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,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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 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{ - 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 = 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{ + 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))); + 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){ + 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 = 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 = 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['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); + } + }); +} + } -} + 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 17d1d91fb..eaeb4ff4a 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 @@ -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, diff --git a/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.spec.ts b/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.spec.ts new file mode 100644 index 000000000..a67a5af9b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.spec.ts @@ -0,0 +1,8 @@ +import { NumberToWordsPipe } from './number-to-words.pipe'; + +describe('NumberToWordsPipe', () => { + it('create an instance', () => { + const pipe = new NumberToWordsPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts b/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts new file mode 100644 index 000000000..a81d9b7d1 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/pd-pipes/number-to-words.pipe.ts @@ -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; + } + +} From 438dc072d491d905eb8581306e7c361e9f7aa2d4 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 5 Mar 2019 17:05:38 +0530 Subject: [PATCH 2/2] merg e: kms --- .../list-pd/add-pd/add-pd.component.html | 6 +- .../list-pd/add-pd/add-pd.component.ts | 13 +- .../edit-pd-applicant.component.html | 8 +- .../edit-pd-applicant.component.ts | 4 +- .../edit-pd-master.component.html | 372 ++++++------ .../edit-pd-master.component.ts | 191 +++++-- .../forms/address/address.component.html | 254 +++++---- .../forms/address/address.component.ts | 436 +++++++++----- .../manage-daily-sales.component.html | 1 + .../manage-daily-sales.component.ts | 10 +- ...anage-other-business-income.component.html | 2 +- .../manage-sales/manage-sales.component.html | 13 +- .../manage-sales/manage-sales.component.ts | 53 +- .../assessed-income.component.html | 11 +- .../assessed-income.component.scss | 3 + .../daily-sales-details.component.html | 2 +- .../daily-sales-details.component.scss | 4 + .../gross-profit-calculation.component.html | 4 +- .../gross-profit-calculation.component.ts | 7 + ...her-business-income-details.component.html | 2 +- .../sales-calculation.component.html | 5 +- .../sales-calculation.component.ts | 15 +- .../assets-info/assets-info.component.html | 35 +- .../assets-info/assets-info.component.ts | 193 +++++-- .../business-assets-info.component.html | 256 ++++----- .../business-assets-info.component.ts | 535 ++++++++++++------ .../client-info/client-info.component.ts | 43 +- .../current-loan/current-loan.component.ts | 31 +- .../final-remarks.component.html | 17 +- .../final-remarks/final-remarks.component.ts | 88 +-- .../financial-info.component.html | 15 +- .../financial-info.component.ts | 23 +- .../general-info/general-info.component.html | 6 +- .../general-info/general-info.component.ts | 10 +- .../lender-representative.component.html | 2 +- .../lender-representative.component.ts | 7 +- .../loan-details/loan-details.component.html | 2 +- .../loan-details/loan-details.component.ts | 8 +- .../neighbour-hood.component.ts | 2 - .../other-income/other-income.component.html | 6 + .../other-income/other-income.component.ts | 29 + .../rental-info/rental-info.component.html | 1 + .../start-pd/forms/stock/stock.component.ts | 36 +- .../supplier-info/supplier-info.component.ts | 30 +- .../list-pd/view-pd/view-pd.component.html | 48 +- .../list-pd/view-pd/view-pd.component.scss | 4 + .../list-pd/view-pd/view-pd.component.ts | 449 +++++++-------- .../pd-service/pd-triger.service.ts | 21 +- 48 files changed, 2070 insertions(+), 1243 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index a318ff1b6..1e1b622f6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -131,7 +131,7 @@
- + @@ -209,7 +209,7 @@ - + Enter Valid Mobile Number. @@ -252,7 +252,7 @@ --> - + Enter Valid Mobile Number. diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts index 679d7d3a7..7bd0368f0 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts @@ -89,8 +89,8 @@ export class AddPdComponent implements OnInit, OnDestroy { fk_customer_segment: [null], loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])], applicant_title_name: [''], - applicant_name: [null], - mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])], + applicant_name: [null,Validators.compose([Validators.required])], + mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10),Validators.required])], // landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], // email: [null], applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], @@ -251,7 +251,7 @@ export class AddPdComponent implements OnInit, OnDestroy { label: ['Applicant'], applicant_title_name:[null], coapplicant_name: [null, Validators.compose([Validators.required])], - coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])], + coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], coapplicant_stdcode:[null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], company_name:[null], @@ -268,7 +268,7 @@ export class AddPdComponent implements OnInit, OnDestroy { get pdAddresses() { return this._PDtriggerForm.get('addresses') as FormArray; } createAddresses(): FormGroup { return this._fb.group({ - addressline: [null], + addressline1: [null], fk_city: [null], fk_state: [null], pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ @@ -327,8 +327,7 @@ export class AddPdComponent implements OnInit, OnDestroy { this.lengthCheckToaddMore = 1; } } - getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false; - } + getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;} // save pd in draft saveDraftPD(formValue: any, status: string) { //alert('Inside The Draft PD'); @@ -478,7 +477,7 @@ export class AddPdComponent implements OnInit, OnDestroy { "fk_pd_type": formValue.fk_pd_type, "fk_customer_segment": formValue.fk_customer_segment, "loan_amount": formValue.loan_amount, - "addressline1": formValue.addresses[0].addressline.toUpperCase(), + "addressline1": formValue.addresses[0].addressline1.toUpperCase(), "fk_city": formValue.addresses[0].fk_city, "fk_state": formValue.addresses[0].fk_state, "pincode": formValue.addresses[0].pincode, diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html index 183850d9c..0fb502f71 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html @@ -15,7 +15,7 @@ - Main Applicant + Applicant 1 @@ -51,9 +51,9 @@ - + + Applicant {{i+2}} + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts index 6dcf30d0c..837a4314f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts @@ -87,7 +87,6 @@ export class EditPdApplicantComponent implements OnInit { } createItem(listData): FormGroup { - // console.log('listData',listData); if(listData){ let stdcode; let landline; @@ -181,8 +180,7 @@ export class EditPdApplicantComponent implements OnInit { "isactive":1 }]; formValue.coApplicantItems.forEach((itemElement, itemIndex) => { - // console.log(itemElement.coapplicant_stdcode); - // console.log(itemElement.coapplicant_landline); + let concat_landline if(itemElement.coapplicant_stdcode != null && itemElement.coapplicant_landline != null){ if(itemElement.coapplicant_stdcode == '' && itemElement.coapplicant_landline == ''){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html index 4cdb391c7..d6e682141 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html @@ -5,187 +5,229 @@ {{pageTitle}}
- - + +
- + - + - - - - Select - - - - {{LL.full_name}} - - - - - - - - - - - - - - - Enter Valid Mobile Number. - - - - - Enter Valid STD Code. -  -  - - - Enter Valid Landline Number. - - - - - - Select - - - {{LB.branch_name}} - - - - - - + + + Select - - - {{PL.product_name}} - - - - - - - - - Select - - - {{SPL.subproduct_name}} - - - - - - - - - Select - - {{CSL.abbr}} - - - - - - - Select - - {{PDL.type_name}} - - - - - - - - - - {{"₹"}} {{loanAmtInWords}} Only - - Enter valid amount. - - - - - - - - - - - Select - - {{SL.name}} - - - - - - - - - Select - - {{CL.city_name}} - - - - - - - - - - - Select - {{PL.pincode}} - - + + + + {{LL.full_name}} + + + - - - Enter Valid Pincode. - - + + + + + + + + + + + Enter + Valid Mobile Number. + + + + + Enter + Valid STD Code. +  -  + + + Enter + Valid Landline Number. + + + + + + Select + + + {{LB.branch_name}} + + + + + + + Select + + + {{PL.product_name}} + + + + + + + + + Select + + + {{SPL.subproduct_name}} + + + + + + + + + Select + + {{CSL.abbr}} + + + + + + + Select + + {{PDL.type_name}} + + + + + + + + + + {{"₹"}} + {{loanAmtInWords}} Only + + Enter valid amount. + + + - - + + +
+ + + Address Details #{{i+1}} Deactivited + + + + + + + + + + Select + + {{SL.name}} + + + + + + + + Select + + {{CL.city_name}} + + + + + + + + Select + {{PL.pincode}} + + + + + + + + + + + + + + +    + + + + + +
+ + + + +
- Remarks - + Remarks + -
-
- - - -
+ +
+ + + +
- - - - - - - - - - - - - + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts index 0636bcf42..b7578d5a9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts @@ -12,25 +12,31 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service'; }) export class EditPdMasterComponent implements OnInit { public pageTitle: string = "PD Details"; + pdid: any; errorMessage: any; productList:any; subProductList:any; lenderList:any; customerSegmentList:any; stateList:any; - cityList:any; + cityList:any = []; pdTypeList:any; billingList:any; lenderBranchList: any; pincodeList: any = []; + addressesList : any = []; + addressesDeactivited : any = []; applicantLength:number; // draftStatus: string; // PDTriggerStatus: string; enablePDButton: boolean; currentPDStatus: string; loanAmtInWords : any; + pincodeflag : any = []; public _EditPDtriggerForm:FormGroup; public notifier: NotifierService; + addresses: FormArray; + // create values for status check pdStatusCheck :any={ "DRAFT" :'DRAFT', @@ -46,6 +52,7 @@ export class EditPdMasterComponent implements OnInit { @Inject(MAT_DIALOG_DATA) public data: any) { this.notifier=notifier this.currentPDStatus = data.records.pd_status; + this.pdid = data.records.pd_id; if(this.data.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(this.data.records.loan_amount); } } @@ -57,6 +64,7 @@ export class EditPdMasterComponent implements OnInit { this.getCustomerSegmentList(); this.getStateCityList(); this.getPDTypeList(); + this.getAddresses(); this.loadFormData(); this.applicantLength=this.data.applicantLength; } @@ -74,13 +82,16 @@ export class EditPdMasterComponent implements OnInit { }, error => this.errorMessage = error); } selectedLender(lender){ - // console.log(JSON.stringify(lender)); // alert(JSON.stringify(lender['branches '])); this.lenderBranchList = lender['branches']; - // console.log(this.lenderBranchList); this._EditPDtriggerForm.controls.pd_branch_id.setValue(null); } + getAddresses(){ + + } + + getProductsList(){ this._pd.getProductsDetails().subscribe( data => { @@ -133,8 +144,6 @@ export class EditPdMasterComponent implements OnInit { } loadFormData() { - // console.log('this.data.record',this.data.records); - // console.log('this.reocrds',this.data.records.pincode_id); let stdcode; let landline; if(this.data.records.pd_contact_landline){ @@ -148,8 +157,8 @@ export class EditPdMasterComponent implements OnInit { landline = ''; } } + - this.getCityList(this.data.records.fk_state); // let getpincodeid = this.data.records.pincode != '' ? this.data.records.pincode != null ? (this.pincodeList.filter(data => data.pincode == this.data.records.pincode).pincode_id) // : this.data.records.pincode // : this.data.records.pincode; @@ -168,14 +177,46 @@ export class EditPdMasterComponent implements OnInit { fk_pd_type: [this.data.records.fk_pd_type], fk_customer_segment: [this.data.records.fk_customer_segment], loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])], -   addressline1: [this.data.records.addressline1.toUpperCase()], - fk_city: [this.data.records.fk_city], - fk_state: [this.data.records.fk_state], -   pincode : [this.data.records.pincode_id], - other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], + addresses: this._fb.array([]), + //   addressline1: [this.data.records.addressline1.toUpperCase()], + // fk_city: [this.data.records.fk_city], + // fk_state: [this.data.records.fk_state], + //   pincode : [this.data.records.pincode_id], + // other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], remarks: [this.data.records.remarks], - }); - } + }); + const addressesArray = this._EditPDtriggerForm.get('addresses') as FormArray; + this._pd.getAddressesDetails(this.pdid).subscribe( + data => { + if (data.status == 200) { + this.addressesList = data.records.filter(item => item.isactive == 1); + if (this.addressesList.length > 0) { + + this.addressesList.forEach((val,index)=>{ + this.addressesDeactivited[index] = true; + let obj = { + pd_address_id:val.pd_address_id, + addressline1: val.addressline1.toUpperCase(), + fk_city: val.fk_city, + fk_state: val.fk_state, +   pincode: val.pincode_id, + other_pincode:val.other_pincode, + isactive:1, + } + this.getCityList(val.fk_state,index); + this.getPincode(val.pincode_id,index); + addressesArray.push(this.createAddresses(obj)); + }); + } + else{ + addressesArray.push(this.createAddresses(null)); + } + } + else{ + addressesArray.push(this.createAddresses(null)); + } + }); + } get pdMain() { return this._EditPDtriggerForm.controls; } @@ -192,17 +233,85 @@ export class EditPdMasterComponent implements OnInit { // this.cityList=this.cityList[0].cities; // } //get city list details based on state id - getCityList(stateID:string){ - // console.log('getCityList',stateID); + getCityList(stateID:string,i){ + this._pd.getStateWiseCities(stateID).subscribe(data=>{ if (data.status == 200) { - // console.log(data); - this.cityList = data.records.cities; - this.pincodeList = data.records.pincode; + + this.cityList[i] = data.records.cities; + this.pincodeList[i] = data.records.pincode; } }); } + get pdAddresses() { return this._EditPDtriggerForm.get('addresses') as FormArray; } + createAddresses(data): FormGroup { + if(data == null){ + return this._fb.group({ + fk_pd_id:[this.pdid], + pd_address_id:[null], + addressline1: [null], + fk_city: [null], + fk_state: [null], + pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ + other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + isactive:[1], + }); + } + else{ + return this._fb.group({ + fk_pd_id:[this.pdid], + pd_address_id:[data.pd_address_id], +   addressline1: [data.addressline1.toUpperCase()], + fk_city: [data.fk_city], + fk_state: [data.fk_state], +   pincode : [data.pincode], + other_pincode:[data.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], + isactive:[data.isactive], + }); + } + }; + addAddresses(index) { + console.log(index); + this.addressesDeactivited[index] = true; + console.log('this.addressesDeactivited[index]',this.addressesDeactivited[index]); + this.addresses = this._EditPDtriggerForm.get('addresses') as FormArray; + this.addresses.push(this.createAddresses(null)); + + } + + removeAddresses(index: number,strflag : any) { + const address_control = this._EditPDtriggerForm.controls['addresses']; + if(strflag == 'Deactivited'){ + address_control.controls[index]['controls'].isactive.setValue(0); + this.addressesDeactivited[index] = false; + } + else if(strflag == 'Activited'){ + address_control.controls[index]['controls'].isactive.setValue(1); + this.addressesDeactivited[index] = true; + } + + // console.log('address_control',address_control); + // console.log('address_control.controls[index]',address_control.controls[index]); + // console.log('address_control.controls[index][controls]',address_control.controls[index]['controls']); + + // address_control.controls[index]['controls'].showHide(); + // isactive.setValue(0); + // this.showHide = true; + // var div = document.getElementById('newpost'); + // if (div.style.display !== 'none') { + // div.style.display = 'none'; + // } + // else { + // div.style.display = 'block'; + // } + + // address_control.controls[index].disable(); + // console.log('address_control',address_control); + // address_control.removeAt(index); + } + + getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;} // save pd in draft saveDraftPD(formValue: any, status:string){ @@ -211,7 +320,7 @@ export class EditPdMasterComponent implements OnInit { } //trigger pd triggerPD(formValue: any, status:any){ - // console.log('triggerPD',formValue); + // this._EditPDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]); // this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity(); @@ -272,17 +381,17 @@ export class EditPdMasterComponent implements OnInit { this._EditPDtriggerForm.controls['loan_amount'].clearValidators(); this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['addressline1'].clearValidators(); - this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['addressline1'].clearValidators(); + // this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['fk_city'].clearValidators(); - this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['fk_city'].clearValidators(); + // this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['fk_state'].clearValidators(); - this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['fk_state'].clearValidators(); + // this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); - this._EditPDtriggerForm.controls['pincode'].clearValidators(); - this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); + // this._EditPDtriggerForm.controls['pincode'].clearValidators(); + // this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); this.validateAllFormFields(this._EditPDtriggerForm); } @@ -290,7 +399,7 @@ export class EditPdMasterComponent implements OnInit { submitPdDetails(formValue: any, status:any) { // let updateStatus = this.currentPDStatus == this.pdStatusCheck.DRAFT ? status : this.currentPDStatus == this.pdStatusCheck.TRIGGERED ? status : this.currentPDStatus; let updateStatus = this.currentPDStatus; - // console.log(this._EditPDtriggerForm.value); + if(status != 1){ if(this._EditPDtriggerForm.invalid) { this.validateAllFormFields(this._EditPDtriggerForm); @@ -319,8 +428,8 @@ export class EditPdMasterComponent implements OnInit { return; } else{ - - + // console.log('my_array.addresses',my_array.addresses); + let filteredAddressesdata = my_array.addresses.filter(item => item.isactive == 1); let lenderMasterArray = { "pd_id": my_array.pd_id, "fk_lender_id": my_array.fk_lender_id, @@ -334,15 +443,25 @@ export class EditPdMasterComponent implements OnInit { "fk_pd_type": my_array.fk_pd_type, "fk_customer_segment": my_array.fk_customer_segment, "loan_amount": my_array.loan_amount, -   "addressline1": my_array.addressline1.toUpperCase(), - "fk_city": my_array.fk_city, - "fk_state": my_array.fk_state, -   "pincode": my_array.pincode, - "other_pincode":my_array.other_pincode, +   "addressline1": filteredAddressesdata[0].addressline1.toUpperCase(), + "fk_city": filteredAddressesdata[0].fk_city, + "fk_state": filteredAddressesdata[0].fk_state, +   "pincode": filteredAddressesdata[0].pincode, + "other_pincode":filteredAddressesdata[0].other_pincode, "remarks": my_array.remarks, } - // console.log(lenderMasterArray); + this._pd.updatePDAddress(my_array.addresses).subscribe(result => { + if (result.status == 200) { + this.notifier.notify('success', 'Address Updated.'); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!'); + }//else + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!'); + }); + this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => { if (result.status == 200) { this.notifier.notify('success', 'PD Details Updated.'); 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 43a2473bd..f1971d12f 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 @@ -21,138 +21,158 @@
- -
+
+
+ +

Address Details #{{i+1}}

+
+ +
+
+ + + +
-
- - - -
+
+ + + Select + {{SL.name}} + + -
- - - Select - {{SL.name}} - - + + + Select + {{CL.city_name}} + + - - - Select - {{CL.city_name}} - - + + + Select + {{PL.pincode}} + + - - - Select - {{PL.pincode}} - - + + + + - - - Pincode - Required - +
-
+
+ + + Select + {{m_addressType.address_type}} + + + -
- - - Select - {{m_addressType.address_type}} - - - + + + + - - - Address Type Required - +
-
+
+ + + Select + {{m_locality.locality_name}} + + + -
- - - Select - {{m_locality.locality_name}} - - - - - - - - Locality Required - + + + + + - - - MixUse - Required - -
+ + + + +
- -
- - - Select - {{data.description}} - - - - - - - Select - {{data.rating}} - - - -
- -
- - - - - - - Select - {{uom.name}} - - - - - - UOM - Required - -
- +
+ + + Select + {{data.description}} + + + + + + Select + {{data.rating}} + + + +
+ + +
+ + + + + + + Select + {{uom.name}} + + + + + + + +
+ + +
+ + +
- - +
@@ -317,7 +337,7 @@
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 2d4e6a122..ea09b4586 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 @@ -28,20 +28,20 @@ export class AddressComponent implements OnInit { main_applicant: any; pageTitle: string = "PD Address Details"; - + disableAfterSubmit : boolean = false; /**Declaration of FormField Variables */ //@Input() pdid: number; pdid: number; form_id: number; - pdAddress: string; - pdState: any; - pdCity: any; - pdPincode: any; - pdOtherPincode: any; + // pdAddress: string; + // pdState: any; + // pdCity: any; + // pdPincode: any; + // pdOtherPincode: any; CustSegAbbr: any; loadDataStatus: boolean = true; - placeholderName: any = 'Estimated area of the (Address Type)'; + placeholderName: any = []; /**Array declaration Of Dropdown */ locationdata: any = []; @@ -53,21 +53,23 @@ export class AddressComponent implements OnInit { cityData: any = []; uomData: any = []; + addressesList: any = []; + otherPincodeFlag:any = []; /**Declaration of FormField Variables */ private notifier: NotifierService; public addressForm: FormGroup; - public address: AbstractControl; - public addressType: AbstractControl; - public state: AbstractControl; - public city: AbstractControl; - public pincode: AbstractControl; - public locality: AbstractControl; - public pdLocation: AbstractControl; - public commentLocality: AbstractControl; - public estArea: AbstractControl; - public uom: AbstractControl; + // public address: AbstractControl; + // public addressType: AbstractControl; + // public state: AbstractControl; + // public city: AbstractControl; + // public pincode: AbstractControl; + // public locality: AbstractControl; + // public pdLocation: AbstractControl; + // public commentLocality: AbstractControl; + // public estArea: AbstractControl; + // public uom: AbstractControl; /**Constructor of the class */ constructor(private el: ElementRef, notifier: NotifierService, @@ -77,7 +79,7 @@ export class AddressComponent implements OnInit { private _pd: PdTrigerService, private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { - + // console.log('pd_all_details',pd_all_details); this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.form_id = 5; @@ -85,26 +87,18 @@ export class AddressComponent implements OnInit { this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; - console.log('this.pd_all_details',this.pd_all_details); let CSAbbrSearch = this.pd_all_details.pdmaster_details.customer_segment_abbr.search("-"); this.CustSegAbbr = this.pd_all_details.pdmaster_details.customer_segment_abbr.substr(0, CSAbbrSearch); this.notifier = notifier; - this.pdAddress = this.pd_all_details.pdmaster_details.addressline1; - this.pdState = this.pd_all_details.pdmaster_details.fk_state; - this.getCityAndPincodeDetails(this.pdState); - this.pdCity = this.pd_all_details.pdmaster_details.fk_city; - this.pdPincode = this.pd_all_details.pdmaster_details.pincode_id; - console.log('this.pdPincode', this.pdPincode); - this.pdOtherPincode = this.pdPincode == 1 ? this.pd_all_details.pdmaster_details.other_pincode : ''; - console.log('this.pdOtherPincode', this.pdOtherPincode); - + } /**Init Fns of the class */ ngOnInit() { - + this.initAddressForm(); + this.getMasterDetails('PDLOCATIONAPPROACH', 1); this.getMasterDetails('COMMENTSONLOCALITY', 2); this.getMasterDetails('UOM', 3); @@ -112,70 +106,151 @@ export class AddressComponent implements OnInit { this.getMasterDetails('ADDRESSTYPE', 5); this.getMasterDetails('STATE', 6); - this.initAddressForm(); - let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = '5'; this._pd.retriveForm(params).subscribe(data => { - + const control = this.addressForm.controls['addresses']; if (data.status == 200) { + // console.log('data.records',data.records); + // console.log('data.records.addresses',data.records.addresses); + if (data.records.addresses.length == 0) { + control.push(this.createAddresses(null)); + // this.loadPDAddressesDetails(); + } else { + data.records.addresses.forEach((datas,index) => { + let obj = { + 'address': datas.address, + 'address_type': datas.address_type, + 'address_type_others': datas.address_type_others, + 'state': datas.state, + 'city': datas.city, + 'pincode': datas.pincode, + 'pincode_others': datas.pincode_others, + 'locality': datas.locality, + 'locality_others': datas.locality_others, + 'locality_mixuse': datas.locality_mixuse, + 'pd_location': datas.pd_location, + 'comment_locality': datas.comment_locality, + 'estimated_area': datas.estimated_area, + 'uom': datas.uom, + 'uom_others': datas.uom_others + } + this.getCityAndPincodeDetails(datas.state,index); + this.getOtherPincode(datas.pincode,index); + let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0]; + this.selectedAddressType(selectedAddressType.address_type,index); + if (datas.address_type == 1) { + this.selectedAddressType(datas.address_type_others,index); + } + control.push(this.createAddresses(obj)); + }); + } + - this.addressForm.controls.address.setValue(data.records.address); - this.addressForm.controls.state.setValue(data.records.state); + // this.addressForm.controls.address.setValue(data.records.address); + // this.addressForm.controls.state.setValue(data.records.state); - if (data.records.state != '') { - this.getCityAndPincodeDetails(data.records.state); - this.addressForm.controls.city.setValue(data.records.city); - this.addressForm.controls.pincode.setValue(data.records.pincode); - if (data.records.pincode == 1) { - this.addressForm.controls.pincode_others.setValue(data.records.pincode_others); - this.addressForm.controls.pincode_others.setValidators([Validators.required]); - this.addressForm.controls.pincode_others.updateValueAndValidity(); - } - } + // if (data.records.state != '') { + // this.getCityAndPincodeDetails(data.records.state); + // this.addressForm.controls.city.setValue(data.records.city); + // this.addressForm.controls.pincode.setValue(data.records.pincode); + // if (data.records.pincode == 1) { + // this.addressForm.controls.pincode_others.setValue(data.records.pincode_others); + // this.addressForm.controls.pincode_others.setValidators([Validators.required]); + // this.addressForm.controls.pincode_others.updateValueAndValidity(); + // } + // } - this.addressForm.controls.pd_location.setValue(data.records.pd_location); - this.addressForm.controls.address_type.setValue(data.records.address_type); + // this.addressForm.controls.pd_location.setValue(data.records.pd_location); + // this.addressForm.controls.address_type.setValue(data.records.address_type); - let selectedAddressType = this.addressData.filter(element => element.address_type_id == data.records.address_type)[0]; - this.selectedAddressType(selectedAddressType.address_type); + // let selectedAddressType = this.addressData.filter(element => element.address_type_id == data.records.address_type)[0]; + // this.selectedAddressType(selectedAddressType.address_type); - if (data.records.address_type == 1) { - this.addressForm.controls.address_type_others.setValue(data.records.address_type_others); - this.addressForm.controls.address_type_others.setValidators([Validators.required]); - this.addressForm.controls.address_type_others.updateValueAndValidity(); - this.selectedAddressType(data.records.address_type_others); - } + // if (data.records.address_type == 1) { + // this.addressForm.controls.address_type_others.setValue(data.records.address_type_others); + // this.addressForm.controls.address_type_others.setValidators([Validators.required]); + // this.addressForm.controls.address_type_others.updateValueAndValidity(); + // this.selectedAddressType(data.records.address_type_others); + // } - this.addressForm.controls.comment_locality.setValue(data.records.comment_locality); + // this.addressForm.controls.comment_locality.setValue(data.records.comment_locality); - this.addressForm.controls.locality.setValue(data.records.locality); + // this.addressForm.controls.locality.setValue(data.records.locality); - if (data.records.locality == 1) { - this.addressForm.controls.locality_others.setValue(data.records.locality_others); - this.addressForm.controls.locality_others.setValidators([Validators.required]); - this.addressForm.controls.locality_others.updateValueAndValidity(); - } - if (data.records.locality == 5) { - this.addressForm.controls.locality_mixuse.setValue(data.records.locality_mixuse); - this.addressForm.controls.locality_mixuse.setValidators([Validators.required]) - this.addressForm.controls.locality_mixuse.updateValueAndValidity(); - } + // if (data.records.locality == 1) { + // this.addressForm.controls.locality_others.setValue(data.records.locality_others); + // this.addressForm.controls.locality_others.setValidators([Validators.required]); + // this.addressForm.controls.locality_others.updateValueAndValidity(); + // } + // if (data.records.locality == 5) { + // this.addressForm.controls.locality_mixuse.setValue(data.records.locality_mixuse); + // this.addressForm.controls.locality_mixuse.setValidators([Validators.required]) + // this.addressForm.controls.locality_mixuse.updateValueAndValidity(); + // } + + // this.addressForm.controls.estimated_area.setValue(data.records.estimated_area); + // this.addressForm.controls.uom.setValue(data.records.uom); + // if (data.records.uom == 1) { + // this.addressForm.controls.uom_others.setValue(data.records.uom_others); + // this.addressForm.controls.uom_others.setValidators([Validators.required]) + // this.addressForm.controls.uom_others.updateValueAndValidity(); + // } - this.addressForm.controls.estimated_area.setValue(data.records.estimated_area); - this.addressForm.controls.uom.setValue(data.records.uom); - if (data.records.uom == 1) { - this.addressForm.controls.uom_others.setValue(data.records.uom_others); - this.addressForm.controls.uom_others.setValidators([Validators.required]) - this.addressForm.controls.uom_others.updateValueAndValidity(); - } this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark); } + else{ + this.loadPDAddressesDetails(); + } + // else { + // control.push(this.createAddresses(null)); + // } }); } + loadPDAddressesDetails(){ + const control = this.addressForm.controls['addresses']; + this._pd.getAddressesDetails(this.pdid).subscribe( + data => { + if (data.status == 200) { + this.addressesList = data.records.filter(item => item.isactive == 1); + // console.log('this.addressesList',this.addressesList); + + if (this.addressesList.length > 0) { + this.addressesList.forEach((val,index)=>{ + let obj = { + 'address': val.addressline1, + 'address_type': '', + 'address_type_others': '', + 'state': val.fk_state, + 'city': val.fk_city, + 'pincode': val.pincode_id, + 'pincode_others': val.other_pincode, + 'locality': '', + 'locality_others': '', + 'locality_mixuse': '', + 'pd_location': '', + 'comment_locality': '', + 'estimated_area': '', + 'uom': '', + 'uom_others': '' + } + this.getCityAndPincodeDetails(val.fk_state,index); + this.getOtherPincode(val.pincode_id,index); + control.push(this.createAddresses(obj)); + }); + } + // else{ + // control.push(this.createAddresses(null)); + // } + } + // else{ + // control.push(this.createAddresses(null)); + // } + }); + } // getM_Address_Type() { // this._pd.getAllMasterDatas('ADDRESSTYPE').subscribe( // data => { @@ -192,13 +267,52 @@ export class AddressComponent implements OnInit { /** Address Form ELements */ public initAddressForm(): void { this.addressForm = this.fb.group({ - address: [this.pdAddress != '' ? this.pdAddress : '', Validators.compose([Validators.required])], + addresses: this.fb.array([]), + address_form_remark: [''] + }); + // this.address = this.addressForm.controls['address']; + // this.state = this.addressForm.controls['state']; + // this.city = this.addressForm.controls['city']; + // this.pincode = this.addressForm.controls['pincode']; + // this.addressType = this.addressForm.controls['address_type']; + // this.locality = this.addressForm.controls['locality']; + // this.pdLocation = this.addressForm.controls['pd_location']; + // this.commentLocality = this.addressForm.controls['comment_locality']; + // this.estArea = this.addressForm.controls['estimated_area']; + // this.uom = this.addressForm.controls['uom']; + } + +/** FOR Adress */ +createAddresses(AddressDetails): FormGroup { + if(AddressDetails != null){ + return this.fb.group({ + address: [AddressDetails.address, Validators.compose([Validators.required])], + address_type: [AddressDetails.address_type, Validators.compose([Validators.required])], + address_type_others: [AddressDetails.address_type_others], + state: [AddressDetails.state], + city: [AddressDetails.city], + pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ + pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + locality: [AddressDetails.locality, Validators.compose([Validators.required])], + locality_others: [AddressDetails.locality_others], + locality_mixuse: [AddressDetails.locality_mixuse], + pd_location: [AddressDetails.pd_location, Validators.compose([Validators.required])], + comment_locality: [AddressDetails.comment_locality, Validators.compose([Validators.required])], + estimated_area: [AddressDetails.estimated_area], + uom: [AddressDetails.uom], + uom_others: [AddressDetails.uom_others] + }); + + } + else{ + return this.fb.group({ + address: ['', Validators.compose([Validators.required])], address_type: ['', Validators.compose([Validators.required])], address_type_others: [''], - state: [this.pdState != '' ? this.pdState : ''], - city: [this.pdCity != '' ? this.pdCity : ''], - pincode: [this.pdPincode != '' ? this.pdPincode : ''],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ - pincode_others: [this.pdOtherPincode != '' ? this.pdOtherPincode : '', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], + state: [''], + city: [''], + pincode: [''], + pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], locality: ['', Validators.compose([Validators.required])], locality_others: [''], locality_mixuse: [''], @@ -206,22 +320,20 @@ export class AddressComponent implements OnInit { comment_locality: ['', Validators.compose([Validators.required])], estimated_area: [''], uom: [''], - uom_others: [''], - address_form_remark: [''] - //additional_premises: this.fb.array([]) + uom_others: [''] }); - this.address = this.addressForm.controls['address']; - this.state = this.addressForm.controls['state']; - this.city = this.addressForm.controls['city']; - this.pincode = this.addressForm.controls['pincode']; - this.addressType = this.addressForm.controls['address_type']; - this.locality = this.addressForm.controls['locality']; - this.pdLocation = this.addressForm.controls['pd_location']; - this.commentLocality = this.addressForm.controls['comment_locality']; - this.estArea = this.addressForm.controls['estimated_area']; - this.uom = this.addressForm.controls['uom']; - } + } +} +// addAddresses() { +// const address_control = this.addressForm.controls['addresses']; +// address_control.push(this.createAddresses(null)); +// } + +// removeAddresses(index: number) { +// const address_control = this.addressForm.controls['addresses']; +// address_control.removeAt(index); +// } /** To Get Dropdown Data For Address Form */ getMasterDetails(table: string, type: number) { @@ -233,7 +345,7 @@ export class AddressComponent implements OnInit { else if (type == 2 && val.isactive == 1) { this.commentData.push(val); } - else if (type == 3 && val.isactive == 1) { + else if (type == 3 && val.isactive == 1 && val.is_land_uom != 0) { this.uomData.push(val); } else if (type == 4 && val.isactive == 1) { @@ -252,109 +364,145 @@ export class AddressComponent implements OnInit { /** To Get City And Pincode Data For Address Form * Param 'stateID' -> selected StateId */ - getCityAndPincodeDetails(stateID: string) { + getCityAndPincodeDetails(stateID: string,index) { this._pd.getStateWiseCities(stateID).subscribe(data => { if (data.status == 200) { - this.cityData = data.records.cities; - this.pincodeData = data.records.pincode; + this.cityData[index] = data.records.cities; + this.pincodeData[index] = data.records.pincode; } }); } + 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(); - 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(); + // 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(); - 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(); + // 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(); - 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(); + // 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(); - 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(); + // 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.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.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 (!this.addressForm.valid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); + this.disableAfterSubmit = false; return; } - // if(this.address.value.bussiness_activity_remark == ''){ - // this.notifier.notify('warning', 'Fill Remark!'); - // return; - // } - + if(this.addressForm.value.bussiness_activity_remark == ''){ + this.notifier.notify('warning', 'Fill Remark!'); + this.disableAfterSubmit = false; + return; + } + this.disableAfterSubmit = true; let records: any = {}; - records.address = this.address.value; - records.state = this.state.value; - records.city = this.city.value; - records.address_type = this.addressType.value; + 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.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 = 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.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.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.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.estimated_area = this.estArea.value; - records.uom = this.uom.value; - records.uom_others = records.uom == 1 ? - this.addressForm.controls.uom_others.value : ''; + // records.uom = this.uom.value; + // records.uom_others = records.uom == 1 ? + // this.addressForm.controls.uom_others.value : ''; records.pdid = this.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.'); setTimeout(() => { this.dialogRef.close(); + this.disableAfterSubmit = false; }, 3000); } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; }); } /** For PlaceHolder * selected AddressType is concate with label */ - selectedAddressType(e: any) { - console.log(e); - this.placeholderName = 'Estimated area of the ' + e; + selectedAddressType(e: any,i) { + + this.placeholderName[i] = 'Estimated area of the ' + e; } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html index 3606a00bf..976ce3781 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/AI-diologue/manage-daily-sales/manage-daily-sales.component.html @@ -21,6 +21,7 @@ + {{"₹"}} {{marginAmtInwords[s]}} Only +
@@ -302,11 +309,11 @@
- + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss index a63b81ec4..1cfc15b89 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/assessed-income.component.scss @@ -12,6 +12,9 @@ color:#e00201 !important; } + .complete-button button { + margin-top: 10px; + } .paragraph_change { color: #fff !important; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html index f0951717b..4fa675d08 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.html @@ -19,7 +19,7 @@ {{expandDetails.salesItem}} - (Margin Percentage % : {{expandDetails.margin_per}}   Margin Value : {{expandDetails.margin_value}}) +  ( Margin Percentage : {{expandDetails.margin_per}} %   Margin Value : {{expandDetails.margin_value}} ) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss index 588f58a6b..f350cbf76 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/daily-sales-details/daily-sales-details.component.scss @@ -31,3 +31,7 @@ tr.mat-footer-row { .delete-margin { margin-left: 3%; } +.mat-footer-cell { + font-weight: bold; + font-size: 1.2rem !important; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html index 42dd4466c..8736c7ffd 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.html @@ -10,11 +10,11 @@ {{getData.name}} - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts index 381a24d93..4e8676fbe 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/gross-profit-calculation/gross-profit-calculation.component.ts @@ -24,7 +24,14 @@ export class GrossProfitCalculationComponent implements OnInit, OnChanges { } changeOptions(values: any){ + // console.log('values',values); this.grossProfitForm.controls['margin'].setValue(''); + /** if Mode Value is 'No' -> margin value is setted as netmargin and its id - 2 + * Refer => check_sales_type **/ + if(values.mode == 2){ + // console.log('2'); + this.grossProfitForm.controls['margin'].setValue('2'); + } } submitDetails(records: any){ if (this.grossProfitForm.invalid) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html index 202ec4434..5a0e24d62 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/other-business-income-details/other-business-income-details.component.html @@ -15,7 +15,7 @@ - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html index 9d54b4f61..19c2839e9 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.html @@ -3,16 +3,19 @@ Sales Calculation - + {{activateMariginCalculation}} + {{"₹"}} {{SaleAmtInwords}} Only + + {{"₹"}} {{marginAmtInwords}} Only diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts index 321254f47..2860eec0b 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assessed-income/sales-calculation/sales-calculation.component.ts @@ -15,6 +15,8 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck { salesCalculationForm:FormGroup; activateMariginCalculation: boolean; private notifier: NotifierService; + SaleAmtInwords : any; + marginAmtInwords: any; constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) { this.activateMariginCalculation=false; this.notifier = notifier; @@ -23,9 +25,12 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck { ngOnInit() { } salesCalculation(values): void { + if(values.sales_declared_by_customer !=''){this.SaleAmtInwords = this._pd.convertNumberToWords(values.sales_declared_by_customer);} if(values.margin_per !='' && values.sales_declared_by_customer !='') { + this.salesCalculationForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100)); + this.marginAmtInwords = this._pd.convertNumberToWords(values.sales_declared_by_customer * (values.margin_per/100)); } } // save sales calculations details @@ -60,7 +65,9 @@ validateAllFormFields(formGroup: any) { // do check component bases ngDoCheck() { - +// console.log('ngDoCheck this.activateMariginCalculation',this.activateMariginCalculation); +// console.log('ngDoCheck this.masterData.grossProfitTypeList',this.masterData.grossProfitTypeList); +// console.log('69',this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin); if(this.masterData.grossProfitTypeList.length>0){ this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false; } @@ -71,6 +78,9 @@ ngDoCheck() { //detect chnges from parent ngOnChanges(changes: SimpleChanges) { + // console.log('ngDoCheck this.activateMariginCalculation',this.activateMariginCalculation); + // console.log('ngDoCheck this.masterData.grossProfitTypeList',changes.masterData); + // console.log('82',changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode); if(changes.masterData){ if(changes.masterData.currentValue.grossProfitTypeList.length>0){ this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false; @@ -78,6 +88,8 @@ ngOnChanges(changes: SimpleChanges) { } if(changes.parentData){ if(changes.parentData.currentValue.length>0){ + this.SaleAmtInwords = this._pd.convertNumberToWords(changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer); + this.marginAmtInwords = this._pd.convertNumberToWords(changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_value); this.salesCalculationForm = this._fb.group({ sdc_id:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sdc_id], sales_declared_by_customer:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer, Validators.compose([Validators.required])], @@ -100,5 +112,4 @@ ngOnChanges(changes: SimpleChanges) { } } - } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html index c57f7e4a6..4572e9cad 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.html @@ -42,7 +42,7 @@
- + Select {{ prop.name }} @@ -51,6 +51,31 @@
+
+ + + + + + +
+
+ + + + + + Select + {{ uom.name }} + + + + + +
@@ -254,8 +279,8 @@ - + {{val.name}} @@ -264,7 +289,7 @@ - + @@ -463,7 +488,7 @@
- +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts index 703b67ace..2066a1bad 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts @@ -45,6 +45,9 @@ export class AssetsInfoComponent implements OnInit { public applicants: any; otherEmiamtFlag : boolean = false; businessEmiAmtFlag : boolean = false; + isOtherOwner:any = []; + disableAfterSubmit : boolean = false; + public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, {'value': "no",'viewValue': "No"}, {'value': "nan",'viewValue': "NA"}] @@ -70,6 +73,8 @@ export class AssetsInfoComponent implements OnInit { public m_freqOfPurchase = []; public m_vehicle_type = []; + + public m_uom_type = []; private notifier: NotifierService; existCompanyList: any =[]; @@ -117,30 +122,31 @@ export class AssetsInfoComponent implements OnInit { // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; // }); + this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ - if(data.dataStatus){ - this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true); + if (data.dataStatus) { + this.existCompanyList = data.records.filter(val => val.is_active === true); } + + // get company list + let modifyCompanyList: any = []; + if (this.existCompanyList.length > 0) { + modifyCompanyList = this.existCompanyList.map(element => { + return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 }; + }); + this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) + } + // get applicant list + let modifyApplicantList: any=[]; + if(this.applicants.length > 0){ + modifyApplicantList = this.applicants.map(element => { + return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; + }); + this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) - let modifyCompanyList : any=[]; - if(this.existCompanyList.length>0){ - modifyCompanyList = this.existCompanyList.map(element => { - return {id:element.company_order_id.toString(),name:element.company_name,group_id:1}; - }); - this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList}) - } - - }) - // get applicant list - let modifyApplicantList: any=[]; - if(this.applicants.length > 0){ - modifyApplicantList = this.applicants.map(element => { - return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2}; - }); - this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList}) - - } - + } + + }) this.getPdSupplierFormDetails(); this.getM_Assets_Type(); this.getM_PropertyType(); @@ -149,6 +155,7 @@ export class AssetsInfoComponent implements OnInit { //this.getM_Relation(); //this.getM_InsuranceType(); this.getM_Vehicle_Type(); + this.getM_UOM_Type(); } // ====================== @@ -221,6 +228,15 @@ export class AssetsInfoComponent implements OnInit { }) } + getM_UOM_Type() { + this.pdTrigerService.getAllMasterDatas('UOM').subscribe( + data => { + this.m_uom_type = data.records.filter(data => data.isactive == 1 && data. is_land_uom == 1 || data. is_land_uom == 2); + // console.log('this.m_uom_type',data.records,this.m_uom_type); + // + }) + } + // getM_InsuranceType() { // this.pdTrigerService.getAllMasterDatas('INSURANCETYPE').subscribe( // data => { @@ -372,7 +388,12 @@ export class AssetsInfoComponent implements OnInit { loadProperty() { return this._formBuilder.group({ property_type: [''], - other_property_type: [''] + other_property_type: [''], + address_of_the_property :[''], + describe_of_the_property_asset :[''], + area_covered_by_this_property :[''], + uom_of_the_property:[''], + other_uom:[''] }); } @@ -452,7 +473,12 @@ export class AssetsInfoComponent implements OnInit { loadPropertyWithData(data) { return this._formBuilder.group({ property_type: [data.property_type], - other_property_type: [data.other_property_type] + other_property_type: [data.other_property_type], + address_of_the_property :[data.address_of_the_property], + describe_of_the_property_asset :[data.describe_of_the_property_asset], + area_covered_by_this_property :[data.area_covered_by_this_property], + uom_of_the_property:[data.uom_of_the_property], + other_uom : [data.other_uom] //property_type:[''] }); } @@ -569,11 +595,7 @@ export class AssetsInfoComponent implements OnInit { var result = Object.keys(supp_data).map(function (key) { return supp_data[key]; }); - result.forEach((datas,index) => { - - this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value); - - }); + if (result.length > 0) { for (let val of result) { let vals = { @@ -588,9 +610,21 @@ export class AssetsInfoComponent implements OnInit { emi: val.emi, }; const control = this._assetsQuesFrom.controls['assets_details']; + + // let Avaliablity = 1; + // val.name_of_the_owner.forEach(option => { + // if(option.id == 0 && option.group_id == 2){ + // Avaliablity = option.id; + // } + // }); + // this.isOtherOwner = Avaliablity == 0 ? true : false; control.push(this.initDetailsWithdata(vals)); this.setAssetsDetailsWithData(vals.assets_mode, val.details, control.length - 1) } + result.forEach((datas,index) => { + this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value); + this.setRequiredValidation(datas.name_of_the_owner,index,'',4); + }); } this.loadDetails = true; } @@ -626,7 +660,10 @@ export class AssetsInfoComponent implements OnInit { case '2': { let array_data : any; data.forEach((datas,i) => { - array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type }; + array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type, + 'address_of_the_property' :datas.address_of_the_property,'describe_of_the_property_asset' :datas.describe_of_the_property_asset, + 'uom_of_the_property':datas.uom_of_the_property, + 'area_covered_by_this_property' :datas.area_covered_by_this_property,'other_uom':datas.other_uom }; }); const control = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray; control.push(this.loadPropertyWithData(array_data)); @@ -764,8 +801,10 @@ export class AssetsInfoComponent implements OnInit { // stop here if form is invalid if (this._assetsQuesFrom.invalid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); + this.disableAfterSubmit = false; return; } else { + this.disableAfterSubmit = true; var answerFormValues = this._assetsQuesFrom.value; //To Remove The "Null" With Key also @@ -777,13 +816,16 @@ export class AssetsInfoComponent implements OnInit { this.notifier.notify('success', 'Saved Successfully.'); setTimeout(() =>{ this.dialogRef.close(); + this.disableAfterSubmit = false; },3000); } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; // this.dialogRef.close(); }); //After Saving the BRANCH data then popup close @@ -829,38 +871,75 @@ export class AssetsInfoComponent implements OnInit { // } } - setRequiredValidation(value,item,flag) { - + setRequiredValidation(value,ParInx,ChdInx,flag) { + // console.log('value',value,'ParInx',ParInx,'ChdInx',ChdInx,'flag',flag); + let ParCtrls = this._assetsQuesFrom.controls.assets_details; + // console.log('ParCtrls',ParCtrls); + let ChdCtrls:any = ParCtrls.controls[ParInx]; + // console.log('ChdCtrls',ChdCtrls); if(flag == 1){ value==1 - ? item.controls.other_property_type.setValidators([Validators.required]) - : item.controls.other_property_type.clearValidators(); - item.controls.other_property_type.updateValueAndValidity(); + + // ? controls2[ChdInx].controls.other_property_type.setValidators([Validators.required]) + // : item.controls.other_property_type.clearValidators(); + // item.controls.other_property_type.updateValueAndValidity(); } - if(flag == 2){ - value==1 - ? item.controls.other_frequency_mode.setValidators([Validators.required]) - : item.controls.other_frequency_mode.clearValidators(); - item.controls.other_frequency_mode.updateValueAndValidity(); + // if(flag == 2){ + // value==1 + // ? item.controls.other_frequency_mode.setValidators([Validators.required]) + // : item.controls.other_frequency_mode.clearValidators(); + // item.controls.other_frequency_mode.updateValueAndValidity(); + // } + // if(flag == 3){ + // value==1 + // ? item.controls.other_investments_type.setValidators([Validators.required]) + // : item.controls.other_investments_type.clearValidators(); + // item.controls.other_investments_type.updateValueAndValidity(); + // } + // if(flag == 4){ + // value==0 + // ? item.controls.other_owner.setValidators([Validators.required]) + // : item.controls.other_owner.clearValidators(); + // item.controls.other_owner.updateValueAndValidity(); + // } + if (flag == 4) { + let Avaliablity = 1; + // console.log('val',value); + value.forEach(option => { + if(option.id == 0 && option.group_id == 2){ + Avaliablity = option.id; + } + }); + if(Avaliablity == 0){ + // console.log('if Avaliablity',Avaliablity); + // console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); + ChdCtrls.controls.other_owner.setValidators([Validators.required]); + this.isOtherOwner[ParInx] = true; + // console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); + }else if(Avaliablity == 1){ + // console.log('else Avaliablity',Avaliablity); + // console.log('esle this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); + ChdCtrls.controls.other_owner.setValue(''); + ChdCtrls.controls.other_owner.clearValidators(); + this.isOtherOwner[ParInx] = false; + // console.log('else this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]); + } + + ChdCtrls.controls.other_owner.updateValueAndValidity(); + } - if(flag == 3){ - value==1 - ? item.controls.other_investments_type.setValidators([Validators.required]) - : item.controls.other_investments_type.clearValidators(); - item.controls.other_investments_type.updateValueAndValidity(); - } - if(flag == 4){ - value==0 - ? item.controls.other_owner.setValidators([Validators.required]) - : item.controls.other_owner.clearValidators(); - item.controls.other_owner.updateValueAndValidity(); - } - if(flag == 5){ - value==1 - ? item.controls.other_vehicle_type.setValidators([Validators.required]) - : item.controls.other_vehicle_type.clearValidators(); - item.controls.other_vehicle_type.updateValueAndValidity(); -} +// if(flag == 5){ +// value==1 +// ? item.controls.other_vehicle_type.setValidators([Validators.required]) +// : item.controls.other_vehicle_type.clearValidators(); +// item.controls.other_vehicle_type.updateValueAndValidity(); +// } +// if(flag == 6){ +// value==1 +// ? item.controls.other_uom.setValidators([Validators.required]) +// : item.controls.other_uom.clearValidators(); +// item.controls.other_uom.updateValueAndValidity(); +// } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html index fcfd379ac..c4a49beca 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.html @@ -15,147 +15,149 @@ -
-
- - - -

Address Details {{addressLabel | titlecase}}

-
-
+
+
+
+
+
+ + + +

Address Details {{ " : " + itemrow.get('address_label').value | titlecase}}

+
+
-
- - - Select - Yes - No - - -
+
+ + + Select + Yes + No + + +
-
-
- - - - {{yearErrorMessage}} - Year's - Required - - - - {{monthErrorMessage}} - - -
- - - - - Yes - No - - Field - Required - - - - - - Remarks - Required - - -
- -
-
-
-
- - - - Select - Owned - Rented - +
+
+ + + + {{yearErrorMessage[i]}} + - - - - {{"₹"}} - {{RentAmtInwordsForAddress[i]}} Only - Monthly Rent Amount Required + + + {{monthErrorMessage[i]}} + +
-
- - - - {{"₹"}} - {{appxMarketAmtInwordsForAddress[i]}} Only - - - - - - - {{val.name}} - - - - Asset Owned by Required - - - - - - - - Approx Vintage - - - - - - Purchase Year - - - -
+ + + Yes + No + + + - -
- - + + + + + +
+ +
+ + + Select - Yes - No + Owned + Rented + + + + {{"₹"}} + {{RentAmtInwordsForAddress[i]}} Only + Monthly Rent Amount Required + + + +
+ + + + {{"₹"}} + {{appxMarketAmtInwordsForAddress[i]}} Only + + + + + + + {{val.name}} + + + + Asset Owned by Required + + + + + + + + Approx Vintage + + + + + + Purchase Year + + + +
+ + + +
+ + + Select + Yes + No + + +
+
+
-
+ + +
-
-
-
-
+
@@ -313,7 +315,7 @@ Asset Owned by Required - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts index fcc628537..d2415150f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts @@ -28,21 +28,22 @@ export class BusinessAssetsInfoComponent implements OnInit { /**Declaration of Form Fields Variables */ pdid: string; company_id: any; - placeholderName: any = 'Was any business activity seen at the Address Type during PD visit?'; + placeholderName: any = []; + // 'Was any business activity seen at the Address Type during PD visit?'; private notifier: NotifierService; public _businessAssetsQuesFrom: FormGroup; public submitted = false; - isOtherOwnerForAddress : boolean = false; - isOtherOwner: boolean = false; + isOtherOwnerForAddress : any = []; + isOtherOwner : any = []; loadDetails: boolean; CustSegAbbr: any; generalExistBusinessYear: Number; generalExistBusinessMonth: Number; - yearErrorMessage: any; - monthErrorMessage: any; + yearErrorMessage: any = []; + monthErrorMessage: any = []; currentYear: any = new Date().getFullYear(); - addressLabel: any; + addressLabel: any = []; /**Declaration of Dropdown And Array */ public applicants: any; @@ -120,25 +121,6 @@ export class BusinessAssetsInfoComponent implements OnInit { this.getM_PropertyType(); this.getM_Address_Type(); this.getM_Vehicle_Type(); - - let params: any = {}; - params.pd_id = this.pdid; - params.pd_form_id = '5'; - - this.pdTrigerService.retriveForm(params).subscribe(data => { - if (data.status == 200) { - - this.addressLabel = ''; - - let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.records.address_type)[0]; - let address = data.records.address; - let addressType = data.records.address_type != 1 ? selectedAddressType.address_type : data.records.address_type_others; - - this.placeholderName = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; - this.addressLabel = " : " + address + ' / ' + addressType; - - } - }); } /** Assets Type For Dropdown List */ @@ -189,9 +171,9 @@ export class BusinessAssetsInfoComponent implements OnInit { this.pdTrigerService.getPDFormDetailsWithCompanyID(this.pdid, '22', this.company_id).subscribe( data => { if (data) { - console.log('data.records',data); + if (data.dataStatus) { - console.log('data.records',data.records); + this.formLoadData(data.records); } else { this.formLoadData(null); @@ -203,6 +185,79 @@ export class BusinessAssetsInfoComponent implements OnInit { } ); } + loadaddresses(){ + // console.log('function inside loaded'); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = '5'; + + this.pdTrigerService.retriveForm(params).subscribe(data => { + // console.log('response',data); + if (data.status == 200) { + let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1); + // console.log(data.records); + // console.log(data.records.addresses); + // console.log(dataOfAddress); + // // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + + if(data.records.addresses.length > 0){ + data.records.addresses.forEach((data,inx)=>{ + // console.log(data); + + this.addressLabel[inx] = ''; + + let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.address_type)[0]; + let address = data.address; + let addressType = data.address_type != 1 ? selectedAddressType.address_type : data.address_type_others; + + this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; + let addressLabel = address + ' / ' + addressType; + + let vals = { + address_label:addressLabel, + business_years: '', + business_month: '', + business_address_availability: '', + business_is_pd_visited: '', + business_pd_visited_remark: '', + business_approximate_market_value: '', + business_ownership_type: '', + business_monthly_rented_amt: '', + business_name_of_the_owner: '', + business_name_of_the_other_owner: '', + business_vintage: '', + business_purchase_year: '', + business_emi: '' + } + + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetailsWithdata(vals)); + }); + } + else{ + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetails()); + } + } + else{ + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetails()); + } + }); +} + // business_years: [value.business_years], + // business_month: [value.business_month], + // business_address_availability: [value.business_address_availability], + // business_is_pd_visited: [value.business_is_pd_visited], + // business_pd_visited_remark: [value.business_pd_visited_remark], + // business_assets_for_address: this._formBuilder.array([]), + + // business_years: [''], + // business_month: [''], + // business_address_availability: [''], + // business_is_pd_visited: [''], + // business_pd_visited_remark: [''], + // business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]), /** load Form Data */ formLoadData(val) { @@ -212,38 +267,31 @@ export class BusinessAssetsInfoComponent implements OnInit { pdid: [this.pdid], formid: ['22'], company_id: [this.company_id], - business_years: [value.business_years], - business_month: [value.business_month], - business_address_availability: [value.business_address_availability], - business_is_pd_visited: [value.business_is_pd_visited], - business_pd_visited_remark: [value.business_pd_visited_remark], + // business_address_details: this._formBuilder.array([]), business_assets_for_address: this._formBuilder.array([]), business_assets_details: this._formBuilder.array([]), business_assets_form_remark: [value.business_assets_form_remark || null] }); - if (value.business_address_availability == 'yes') { - console.log(value.business_assets_for_address); - this.addBusinessAssetsForAddress(value.business_assets_for_address); - } - else { - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.createBusinessAssetsForAddress()); - } + // if (value.business_address_availability == 'yes') { + + // this.addBusinessAssetsForAddress(value.business_assets_for_address); + // } + // else { + // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + // control.push(this.createBusinessAssetsForAddress()); + // } + this.addBusinessAddressAssetsDetailsWithData(value.business_assets_for_address); this.addBusinessAssetsDetailsWithData(value.business_assets_details); } else { this._businessAssetsQuesFrom = this._formBuilder.group({ pdid: [this.pdid], formid: ['22'], company_id: [this.company_id], + business_assets_for_address: this._formBuilder.array([]), business_assets_details: this._formBuilder.array([ this.initBusinessDetails() ]), - business_years: [''], - business_month: [''], - business_address_availability: [''], - business_is_pd_visited: [''], - business_pd_visited_remark: [''], - business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]), business_assets_form_remark: [''] }); + this.loadaddresses(); } this.loadDetails = true; } @@ -267,19 +315,41 @@ export class BusinessAssetsInfoComponent implements OnInit { business_emi: [''], }); } - - createBusinessAssetsForAddress(): FormGroup { + + + initBusinessAddressDetails() { return this._formBuilder.group({ - business_approximate_market_value: [''], - business_ownership_type: [''], - business_monthly_rented_amt: [''], - business_name_of_the_owner: [''], - business_name_of_the_other_owner: [''], - business_vintage: [''], - business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], - business_emi: [''] + address_label:[''], + business_years: [''], + business_month: [''], + business_address_availability: [''], + business_is_pd_visited: [''], + business_pd_visited_remark: [''], + // this.createBusinessAssetsForAddress() + // business_details: this._formBuilder.array([]), + business_approximate_market_value: [''], + business_ownership_type: [''], + business_monthly_rented_amt: [''], + business_name_of_the_owner: [''], + business_name_of_the_other_owner: [''], + business_vintage: [''], + business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + business_emi: [''], }); } + + // createBusinessAssetsForAddress(): FormGroup { + // return this._formBuilder.group({ + // business_approximate_market_value: [''], + // business_ownership_type: [''], + // business_monthly_rented_amt: [''], + // business_name_of_the_owner: [''], + // business_name_of_the_other_owner: [''], + // business_vintage: [''], + // business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + // business_emi: [''] + // }); + // } selectedPropertyOwnedType(e, s, i) { @@ -387,18 +457,18 @@ export class BusinessAssetsInfoComponent implements OnInit { } - createBusinessAssetsForAddressWithData(data): FormGroup { - return this._formBuilder.group({ - business_approximate_market_value: [data.business_approximate_market_value], - business_ownership_type: [data.business_ownership_type], - business_monthly_rented_amt: [data.business_monthly_rented_amt], - business_name_of_the_owner: [data.business_name_of_the_owner], - business_name_of_the_other_owner: [data.business_name_of_the_other_owner], - business_vintage: [data.business_vintage], - business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], - business_emi: [data.business_emi] - }); - } + // createBusinessAssetsForAddressWithData(data): FormGroup { + // return this._formBuilder.group({ + // business_approximate_market_value: [data.business_approximate_market_value], + // business_ownership_type: [data.business_ownership_type], + // business_monthly_rented_amt: [data.business_monthly_rented_amt], + // business_name_of_the_owner: [data.business_name_of_the_owner], + // business_name_of_the_other_owner: [data.business_name_of_the_other_owner], + // business_vintage: [data.business_vintage], + // business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + // business_emi: [data.business_emi] + // }); + // } initBusinessDetailsWithdata(data) { @@ -417,49 +487,116 @@ export class BusinessAssetsInfoComponent implements OnInit { return formGroup; } - - addBusinessAssetsForAddress(data) { - console.log(data); - var result = Object.keys(data).map(function (key) { - return data[key]; + initBusinessAddressDetailsWithdata(data) { + return this._formBuilder.group({ + address_label:[data.address_label], + business_years: [data.business_years], + business_month: [data.business_month], + business_address_availability: [data.business_address_availability], + business_is_pd_visited: [data.business_is_pd_visited], + business_pd_visited_remark: [data.business_pd_visited_remark], + business_approximate_market_value: [data.business_approximate_market_value], + business_ownership_type: [data.business_ownership_type], + business_monthly_rented_amt: [data.business_monthly_rented_amt], + business_name_of_the_owner: [data.business_name_of_the_owner], + business_name_of_the_other_owner: [data.business_name_of_the_other_owner || ''], + business_vintage: [data.business_vintage], + business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], + business_emi: [data.business_emi || ''], }); - if (result.length > 0) { - result.forEach((datas, index) => { - this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); - this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); - let Avaliablity = 1; - // console.log(datas.business_name_of_the_owner); - if(datas.business_name_of_the_owner.length > 0){ - datas.business_name_of_the_owner.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); - } - this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false; - - }); - - for (let val of result) { - let vals = { - business_approximate_market_value: val.business_approximate_market_value, - business_ownership_type: val.business_ownership_type, - business_monthly_rented_amt: val.business_monthly_rented_amt, - business_name_of_the_owner: val.business_name_of_the_owner, - business_name_of_the_other_owner: val.business_name_of_the_other_owner, - business_vintage: val.business_vintage, - business_purchase_year: val.business_purchase_year, - business_emi: val.business_emi - }; - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.createBusinessAssetsForAddressWithData(vals)); - } - } else { - const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; - control.push(this.createBusinessAssetsForAddress()); - } } + + // addBusinessAssetsForAddress(data) { + + // var result = Object.keys(data).map(function (key) { + // return data[key]; + // }); + // if (result.length > 0) { + // result.forEach((datas, index) => { + // this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); + // this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); + // let Avaliablity = 1; + + // if(datas.business_name_of_the_owner.length > 0){ + // datas.business_name_of_the_owner.forEach(option => { + // if(option.id == 0 && option.group_id == 2){ + // Avaliablity = option.id; + // } + // }); + // } + // this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false; + + // }); + + // for (let val of result) { + // let vals = { + // business_approximate_market_value: val.business_approximate_market_value, + // business_ownership_type: val.business_ownership_type, + // business_monthly_rented_amt: val.business_monthly_rented_amt, + // business_name_of_the_owner: val.business_name_of_the_owner, + // business_name_of_the_other_owner: val.business_name_of_the_other_owner, + // business_vintage: val.business_vintage, + // business_purchase_year: val.business_purchase_year, + // business_emi: val.business_emi + // }; + // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + // control.push(this.createBusinessAssetsForAddressWithData(vals)); + // } + // } else { + // const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + // control.push(this.createBusinessAssetsForAddress()); + // } + // } + addBusinessAddressAssetsDetailsWithData(data) { + + var result = Object.keys(data).map(function (key) { + return data[key]; + }); + if (result.length > 0) { + result.forEach((datas, index) => { + this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); + this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); + let Avaliablity = 1; + + if(datas.business_name_of_the_owner.length > 0){ + datas.business_name_of_the_owner.forEach(option => { + if(option.id == 0 && option.group_id == 2){ + Avaliablity = option.id; + } + }); + } + this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false; + + }); + + for (let val of result) { + let vals = { + address_label:val.address_label, + business_years: val.business_years, + business_month: val.business_month, + business_address_availability: val.business_address_availability, + business_is_pd_visited: val.business_is_pd_visited, + business_pd_visited_remark: val.business_pd_visited_remark, + business_approximate_market_value: val.business_approximate_market_value, + business_ownership_type: val.business_ownership_type, + business_monthly_rented_amt: val.business_monthly_rented_amt, + business_name_of_the_owner: val.business_name_of_the_owner, + business_name_of_the_other_owner: val.business_name_of_the_other_owner, + business_vintage: val.business_vintage, + business_purchase_year: val.business_purchase_year, + business_emi: val.business_emi + }; + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetailsWithdata(vals)); + // this.initBusinessDetailsWithdata(vals) + } + } else { + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + control.push(this.initBusinessAddressDetails()); + } + } + addBusinessAssetsDetailsWithData(supp_data) { var result = Object.keys(supp_data).map(function (key) { @@ -471,8 +608,13 @@ export class BusinessAssetsInfoComponent implements OnInit { this.appxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_approximate_market_value); this.RentAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_monthly_rented_amt); let Avaliablity = 1; - - this.isOtherOwner = Avaliablity == 0 ? true : false; + + datas.business_name_of_the_owner.forEach(option => { + if(option.id == 0 && option.group_id == 2){ + Avaliablity = option.id; + } + }); + this.isOtherOwner[index] = Avaliablity == 0 ? true : false; }); @@ -647,9 +789,20 @@ export class BusinessAssetsInfoComponent implements OnInit { /** To Convert Month into Year */ - ConvertMonthintoYear(e) { + ConvertMonthintoYear(e,i) { + // const address_control = this._EditPDtriggerForm.controls['addresses']; + // console.log(e); + // console.log(i); + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; + + // control.controls[i]['controls'].isactive.setValue(0); + // address_control.controls[index].disable(); + // console.log(by); + // return; - let business_year = this._businessAssetsQuesFrom.controls.business_years.value; + // console.log('address_control',address_control); + + let business_year = control.controls[i]['controls'].business_years.value; let converted_month: number = e % 12; let converted_year: number = e / 12; @@ -657,60 +810,115 @@ export class BusinessAssetsInfoComponent implements OnInit { let Year = +business_year + +Math.floor(converted_year); if (Year > this.generalExistBusinessYear) { - this.yearErrorMessage = "Higher than Business Vintage"; - this._businessAssetsQuesFrom.controls.business_years.setValue(''); - this._businessAssetsQuesFrom.controls.business_month.setValue(''); + this.yearErrorMessage[i] = "Higher than Business Vintage"; + // this._businessAssetsQuesFrom.controls.business_years.setValue(''); + control.controls[i]['controls'].business_years.setValue(''); + // this._businessAssetsQuesFrom.controls.business_month.setValue(''); + control.controls[i]['controls'].business_month.setValue(''); } else { if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) { - this.monthErrorMessage = "Higher than Business Vintage"; - this._businessAssetsQuesFrom.controls.business_years.setValue(''); - this._businessAssetsQuesFrom.controls.business_month.setValue(''); + this.monthErrorMessage[i] = "Higher than Business Vintage"; + // this._businessAssetsQuesFrom.controls.business_years.setValue(''); + control.controls[i]['controls'].business_years.setValue(''); + control.controls[i]['controls'].business_month.setValue(''); + // this._businessAssetsQuesFrom.controls.business_month.setValue(''); } else { - this.monthErrorMessage = ''; - this.yearErrorMessage = ''; - this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); - this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); + this.monthErrorMessage[i] = ''; + this.yearErrorMessage[i] = ''; + // this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); + control.controls[i]['controls'].business_years.setValue(+business_year + +Math.floor(converted_year)); + control.controls[i]['controls'].business_month.setValue(Math.floor(converted_month)); + // this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); } } } - checkWithExistBusinessYear(e) { - + checkWithExistBusinessYear(e,i) { + const control = this._businessAssetsQuesFrom.controls['business_assets_for_address']; if (+e > this.generalExistBusinessYear) { - this.yearErrorMessage = "Higher than Business Vintage"; - this._businessAssetsQuesFrom.controls.business_years.setValue(''); - + this.yearErrorMessage[i] = "Higher than Business Vintage"; + // this._businessAssetsQuesFrom.controls.business_years.setValue(''); + control.controls[i]['controls'].business_years.setValue(''); } else { - this.yearErrorMessage = ''; + this.yearErrorMessage[i] = ''; } } + setRequiredValidation2(value, ParInx,ChdInx, flag) { + if (flag == 4) { + let ParCtrls = this._businessAssetsQuesFrom.controls.assets_details; + let ChdCtrls:any = ParCtrls.controls[ParInx]; + let Avaliablity = 1; + value.forEach(option => { + if(option.id == 0 && option.group_id == 2){ + Avaliablity = option.id; + } + }); + if(Avaliablity == 0){ + + ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]); + this.isOtherOwner[ParInx] = true; + }else{ + + ChdCtrls.controls.business_name_of_the_other_owner.setValue(''); + ChdCtrls.controls.business_name_of_the_other_owner.clearValidators(); + this.isOtherOwner[ParInx] = false; + } + + ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity(); + + } + if(flag == 8){ + let ParCtrls = this._businessAssetsQuesFrom.controls.business_assets_for_address; + let ChdCtrls:any = ParCtrls.controls[ParInx]; + + let Avaliablity = 1; + value.forEach(option => { + if(option.id == 0 && option.group_id == 2){ + Avaliablity = option.id; + } + }); + + if(Avaliablity == 0){ + + ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]); + this.isOtherOwnerForAddress[ParInx] = true; + }else{ + + ChdCtrls.controls.business_name_of_the_other_owner.setValue(''); + ChdCtrls.controls.business_name_of_the_other_owner.clearValidators(); + this.isOtherOwnerForAddress[ParInx] = false; + } + + ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity(); + + } + } setRequiredValidation(value, item, flag) { - console.log('controls',item); if (flag == 1) { if (value == 'yes') { - this._businessAssetsQuesFrom.controls.business_years.setValidators([Validators.required]); - this._businessAssetsQuesFrom.controls.business_address_availability.setValidators([Validators.required]); - this._businessAssetsQuesFrom.controls.business_is_pd_visited.setValidators([Validators.required]); - this._businessAssetsQuesFrom.controls.business_pd_visited_remark.setValidators([Validators.required]); + item.controls.business_years.setValidators([Validators.required]); + item.controls.business_address_availability.setValidators([Validators.required]); + item.controls.business_is_pd_visited.setValidators([Validators.required]); + item.controls.business_pd_visited_remark.setValidators([Validators.required]); } else { - this._businessAssetsQuesFrom.controls.business_years.clearValidators(); - this._businessAssetsQuesFrom.controls.business_address_availability.clearValidators(); - this._businessAssetsQuesFrom.controls.business_is_pd_visited.clearValidators(); - this._businessAssetsQuesFrom.controls.business_pd_visited_remark.clearValidators(); + item.controls.business_years.clearValidators(); + item.controls.business_address_availability.clearValidators(); + item.controls.business_is_pd_visited.clearValidators(); + item.controls.business_pd_visited_remark.clearValidators(); } - this._businessAssetsQuesFrom.controls.business_years.updateValueAndValidity(); - this._businessAssetsQuesFrom.controls.business_address_availability.updateValueAndValidity(); - this._businessAssetsQuesFrom.controls.business_is_pd_visited.updateValueAndValidity(); - this._businessAssetsQuesFrom.controls.business_pd_visited_remark.updateValueAndValidity(); + item.controls.business_years.updateValueAndValidity(); + item.controls.business_address_availability.updateValueAndValidity(); + item.controls.business_is_pd_visited.updateValueAndValidity(); + item.controls.business_pd_visited_remark.updateValueAndValidity(); } if (flag == 3) { @@ -725,27 +933,7 @@ export class BusinessAssetsInfoComponent implements OnInit { item.controls.business_monthly_rented_amt.updateValueAndValidity(); item.controls.business_name_of_the_owner.updateValueAndValidity(); } - if (flag == 4) { - let Avaliablity = 1; - value.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); - if(Avaliablity == 0){ - - item.controls.business_name_of_the_other_owner.setValidators([Validators.required]); - this.isOtherOwner = true; - }else{ - - item.controls.business_name_of_the_other_owner.setValue(''); - item.controls.business_name_of_the_other_owner.clearValidators(); - this.isOtherOwner = false; - } - - item.controls.business_name_of_the_other_owner.updateValueAndValidity(); - - } + if (flag == 5) { value == 1 ? item.controls.other_vehicle_type.setValidators([Validators.required]) @@ -775,28 +963,7 @@ export class BusinessAssetsInfoComponent implements OnInit { item.controls.business_monthly_rented_amt.updateValueAndValidity(); item.controls.business_name_of_the_owner.updateValueAndValidity(); } - if(flag == 8){ - let Avaliablity = 1; - value.forEach(option => { - if(option.id == 0 && option.group_id == 2){ - Avaliablity = option.id; - } - }); - - if(Avaliablity == 0){ - - item.controls.business_name_of_the_other_owner.setValidators([Validators.required]); - this.isOtherOwnerForAddress = true; - }else{ - - item.controls.business_name_of_the_other_owner.setValue(''); - item.controls.business_name_of_the_other_owner.clearValidators(); - this.isOtherOwnerForAddress = false; - } - - item.controls.business_name_of_the_other_owner.updateValueAndValidity(); - - } + } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts index 00a27ad3f..94b2c1134 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts @@ -189,6 +189,7 @@ export class ClientInfoComponent implements OnInit { data => { if (data.dataStatus) { let dataForm = data.records; + // console.log(dataForm); if (dataForm !== undefined) { this._supplierQuesFrom = this._formBuilder.group({ pdid: [this.pdid], @@ -206,10 +207,15 @@ export class ClientInfoComponent implements OnInit { // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { // return dataForm.main_raw_materials[key]; // }); - let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; - - this.initManufacturingProductsDetails(api_main_raw_materials); - this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null); + if(dataForm.manufacturing_details){ + let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; + this.initManufacturingProductsDetails(api_main_raw_materials); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null); + } + else{ + this.initManufacturingProductsDetails(null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + } } // Load form details for the wholeshale trading details @@ -218,10 +224,16 @@ export class ClientInfoComponent implements OnInit { // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { // return dataForm.trading_products[key]; // }); - let api_trading_products = dataForm.trade_details[0].trading_products; - - this.initTradingProductsDetails(api_trading_products); - this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null); + if(dataForm.trade_details){ + let api_trading_products = dataForm.trade_details[0].trading_products; + this.initTradingProductsDetails(api_trading_products); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null); + } + else{ + this.initTradingProductsDetails(null);- + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); + } + } // Load form details for the service provider prduct details @@ -230,9 +242,18 @@ export class ClientInfoComponent implements OnInit { // let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) { // return dataForm.service_products[key]; // }); - let api_service_provider_products = dataForm.service_provider_details[0].service_products; - this.initServiceProviderProductsDetails(api_service_provider_products); - this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + // let api_service_provider_products = dataForm.service_provider_details[0].service_products; + // this.initServiceProviderProductsDetails(api_service_provider_products); + // this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + if(dataForm.service_provider_details){ + let api_service_provider_products = dataForm.service_provider_details[0].service_products; + this.initServiceProviderProductsDetails(api_service_provider_products); + this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null); + } + else{ + this.initServiceProviderProductsDetails(null); + this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(null); + } } // Load form details for the retail trading details let arr3 = record.filter(data => data.type_of_activity_id == 3); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts index 314a966f4..f76db5061 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts @@ -136,12 +136,12 @@ export class CurrentLoanComponent implements OnInit { const control = this.currentLoanForm.controls['loan_details']; if (value.status == 200) { - console.log('value.records',value.records); + this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan); this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks); if (value.records.existing_loan == 'Yes') { - console.log('value.records.loan_details',); + let loandetails = value.records.loan_details var result = Object.keys(loandetails).map(function (key) { @@ -157,7 +157,7 @@ export class CurrentLoanComponent implements OnInit { //this.selectedLoanTakenBy(val.loan_taken_by,index); let objs = { - 'label': val.loan_amount, + 'label': val.label, 'loan_amount': val.loan_amount, 'frequency':val.frequency, 'other_frequency':val.other_frequency, @@ -184,14 +184,24 @@ export class CurrentLoanComponent implements OnInit { } else { this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{ - + // console.log('data',data); if(data.dataStatus == true){ - - + // console.log('data',data.record); + // return; let AssetData = data.record; + if(AssetData.business_address_asset.length>0){ + AssetData.business_address_asset.map(element => { + this.dataFromAssets.push({mode:0, + mode_name:element.address_label, + details:[], + owner_name:element.business_name_of_the_owner, + form_type:'Data From Bussiness Address'}) + }); + } + if(AssetData.business_assets.length>0){ AssetData.business_assets.map(element => { this.dataFromAssets.push({mode:element.business_assets_mode, @@ -224,7 +234,14 @@ export class CurrentLoanComponent implements OnInit { let labelarray : any = []; this.dataFromAssets.forEach((val,index) => { - + if(val.mode == 0){ + let owner = val.owner_name.map((e => { + return e.name.split(',') + })); + // labelarray[index] = ' : '+owner +' - '+ val.mode_name.split("/")[0] + ' ( ' + val.mode_name.split("/")[1] + ' )'; + labelarray[index] = ' : '+owner +' - '+ val.mode_name; + } + if(val.mode == 1){ let data; let owner diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html index 51f52ce09..5a7ae5e8e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html @@ -42,22 +42,25 @@ {{ list.pdofficer_recommendation }} - - - - + + + + + + + - +
- Remarks - + Other Remarks +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts index d59843d4e..ed805499b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts @@ -69,9 +69,10 @@ export class FinalRemarksComponent implements OnInit { is_service_provided: ['', Validators.required], pd_officers_recommendation:['', Validators.required], others_pd_officers_recommendation:[''], - enter_reason_for_negative:[''], - enter_reason_for_refer_to_credit:[''], - final_form_remarks: ['',Validators.required] + reason_for_positive:[''], + reason_for_negative:[''], + reason_for_refer_to_credit:[''], + final_form_remarks: [''] }); this.getM_Type(); this.getM_Recommendation(); @@ -106,8 +107,9 @@ export class FinalRemarksComponent implements OnInit { this._finalRemarkForm.controls.final_other_customer_behaviour.setValue(data.records.final_other_customer_behaviour); this._finalRemarkForm.controls.pd_officers_recommendation.setValue(data.records.pd_officers_recommendation); this._finalRemarkForm.controls.others_pd_officers_recommendation.setValue(data.records.others_pd_officers_recommendation); - this._finalRemarkForm.controls.enter_reason_for_negative.setValue(data.records.enter_reason_for_negative); - this._finalRemarkForm.controls.enter_reason_for_refer_to_credit.setValue(data.records.enter_reason_for_refer_to_credit); + this._finalRemarkForm.controls.reason_for_positive.setValue(data.records.reason_for_positive); + this._finalRemarkForm.controls.reason_for_negative.setValue(data.records.reason_for_negative); + this._finalRemarkForm.controls.reason_for_refer_to_credit.setValue(data.records.reason_for_refer_to_credit); this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided); this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks); @@ -212,64 +214,68 @@ export class FinalRemarksComponent implements OnInit { // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){ // } - console.log('e',e); + if(e==1){ - console.log('other only',e); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); + + this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]); - this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators(); - this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); - this._finalRemarkForm.controls['enter_reason_for_negative'].setValue(''); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); + + this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); + this._finalRemarkForm.controls['reason_for_positive'].setValue(''); + + this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); + this._finalRemarkForm.controls['reason_for_negative'].setValue(''); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators(); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity(); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue(''); } if(e==2){ - console.log('all Validation clear ',e); + this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); - - this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators(); - this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); - this._finalRemarkForm.controls['enter_reason_for_negative'].setValue(''); + + this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); + + this._finalRemarkForm.controls['reason_for_positive'].setValidators([Validators.required]); + + this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); + this._finalRemarkForm.controls['reason_for_negative'].setValue(''); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators(); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity(); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue(''); } if(e==3){ - console.log('negative only',e); - this._finalRemarkForm.controls['enter_reason_for_negative'].setValidators([Validators.required]); - this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue(''); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators(); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity(); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue(''); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators(); + this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); + this._finalRemarkForm.controls['reason_for_positive'].setValue(''); + + this._finalRemarkForm.controls['reason_for_negative'].setValidators([Validators.required]); + } if(e==4){ - console.log('credit only',e); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValidators([Validators.required]); - this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity(); - + this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue(''); this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); - this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); - this._finalRemarkForm.controls['enter_reason_for_negative'].setValue(''); - this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators(); - this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValidators([Validators.required]); + + this._finalRemarkForm.controls['reason_for_positive'].clearValidators(); + this._finalRemarkForm.controls['reason_for_positive'].setValue(''); + + this._finalRemarkForm.controls['reason_for_negative'].setValue(''); + this._finalRemarkForm.controls['reason_for_negative'].clearValidators(); + } + this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); + this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity(); + this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity(); + this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity(); } - - } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html index 555a7e7d0..080e1b084 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -64,7 +64,7 @@ @@ -137,12 +137,11 @@
- - + No difference in Profit in FY {{details.get('financial_year').value}} over @@ -170,13 +169,13 @@ + - - + No difference in Profit sales % in FY {{details.get('financial_year').value}} over @@ -425,7 +424,7 @@ - diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts index 56682ff74..0d6adea81 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts @@ -94,7 +94,7 @@ export class FinancialInfoComponent implements OnInit { this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; let x = this.customer_segment_abbr.split("-"); this.CustSegAbbr = x[1]; - console.log('this.CustSegAbbr',this.CustSegAbbr); + // console.log('this.CustSegAbbr',this.CustSegAbbr); } //ViewerOption For Docs Display @@ -135,6 +135,7 @@ export class FinancialInfoComponent implements OnInit { let retriveData = value.records; if(value.records.is_financial_statements == 'yes'){ + this.isDisplay = true; /** Backend Data of Asper Statement */ let result = Object.keys(value.records.date_per_financial).map(function(key) { return value.records.date_per_financial[key]; @@ -931,9 +932,9 @@ export class FinancialInfoComponent implements OnInit { } } } - console.log('val.financial_margin_of_profit',val.financial_margin_of_profit); - console.log('profit_margin',profit_margin); - console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value); + // console.log('val.financial_margin_of_profit',val.financial_margin_of_profit); + // console.log('profit_margin',profit_margin); + // console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value); // prev_profit_margin[index] = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit: 0; // prev_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ; prev_profit_margin[index] = profit_margin != '' ? profit_margin : 0; @@ -959,20 +960,20 @@ export class FinancialInfoComponent implements OnInit { if ((profit_margin != '' || loss_margin != '') && index != 0) { - console.log('temp_prev_losses',prev_loss_margin); - console.log('temp_prev_profits',prev_profit_margin); + // console.log('temp_prev_losses',prev_loss_margin); + // console.log('temp_prev_profits',prev_profit_margin); - console.log('curr index',index); + // console.log('curr index',index); loss_margin = loss_margin !== undefined ? loss_margin : 0; profit_margin = profit_margin !== undefined ? profit_margin:0; let temp_prev_loss_margin = prev_loss_margin[index-1] !== undefined ? prev_loss_margin[index-1] : 0 ; let temp_prev_profit_margin = prev_profit_margin[index-1] !== undefined ? prev_profit_margin[index-1] : 0 ; - console.log('profit_margin',profit_margin); - console.log('pre year loss_margin',temp_prev_loss_margin); - console.log('loss_margin',loss_margin); - console.log('pre year profit_margin',temp_prev_profit_margin); + // console.log('profit_margin',profit_margin); + // console.log('pre year loss_margin',temp_prev_loss_margin); + // console.log('loss_margin',loss_margin); + // console.log('pre year profit_margin',temp_prev_profit_margin); if(annual_sale != ''){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html index 6baca4b47..cba606396 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html @@ -164,12 +164,12 @@ - + Relationship Between Individuals - Name @@ -377,7 +377,7 @@
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 43ef3ef61..ec0710802 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 @@ -34,6 +34,8 @@ export class GeneralInfoComponent implements OnInit { count: number = 1; errorMessage: any; maxDate: any; + + disableAfterSubmit : boolean; public pd_applicants_details: any; public _generalForm: FormGroup; @@ -70,6 +72,7 @@ export class GeneralInfoComponent implements OnInit { this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + this.disableAfterSubmit = false; } /********************** Constructor Section Ends Here ****************/ @@ -587,7 +590,7 @@ export class GeneralInfoComponent implements OnInit { // submit form details submitGeneralForm(formData: any) { if (this._generalForm.invalid) { - + this.disableAfterSubmit = false; this.validateAllFormFields(this._generalForm); this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); return; @@ -597,6 +600,7 @@ export class GeneralInfoComponent implements OnInit { // this.notifier.notify('warning', 'Please Choose Name of Person Met.!'); // } else { + this.disableAfterSubmit = true; let saveRecords: any = {} saveRecords.pdid = formData.pdid; saveRecords.formid = formData.formid; @@ -613,15 +617,17 @@ export class GeneralInfoComponent implements OnInit { this.notifier.notify('success', 'Saved Successfully.'); setTimeout(() => { this.dialogRef.close(); + this.disableAfterSubmit = false; }, 3000); - } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; // this.errorMessage = "Some Thing Wents Wrong Try Again !"; } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; // this.errorMessage = "Something Wents Wrong Try Again !"; }); } 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 e9dc2d35d..2d37dca4c 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 @@ -163,7 +163,7 @@
-
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 f2dc7f4de..ec0499193 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 @@ -30,7 +30,7 @@ export class LenderRepresentativeComponent implements OnInit { pageTitle: string ="Lender Representative Details"; pdid: number; form_id: number; - + disableAfterSubmit : boolean = false; //snack bar @@ -141,9 +141,11 @@ export class LenderRepresentativeComponent implements OnInit { submitLRForm() { if (!this.representativeForm.valid) { this.validateAllFormFields(this.representativeForm); + this.disableAfterSubmit = false; this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); return; } + this.disableAfterSubmit = true; let records: any = {}; records.pdid = this.pdid; records.formid = this.form_id; @@ -158,13 +160,16 @@ export class LenderRepresentativeComponent implements OnInit { this.notifier.notify('success', 'Saved Successfully.'); setTimeout(() =>{ this.dialogRef.close(); + this.disableAfterSubmit = false; },3000); } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; }) } validateAllFormFields(formGroup: FormGroup) { 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 a48bbb000..0d2f8e9fe 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 @@ -377,7 +377,7 @@
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts index 7c119dd59..eb7badb24 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts @@ -31,7 +31,7 @@ export class LoanDetailsComponent implements OnInit { lender_applicant_id: any; main_applicant: any; pageTitle: string = "Loan Details"; - + disableAfterSubmit : boolean = false; /**Declaration of formfields Variables */ private notifier: NotifierService; @@ -655,9 +655,10 @@ export class LoanDetailsComponent implements OnInit { if (!this.loanDetailsForm.valid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); + this.disableAfterSubmit = false; return; } - + this.disableAfterSubmit = true; let records: any = {}; records.pdid = this.pdid; records.formid = this.form_id; @@ -746,13 +747,16 @@ export class LoanDetailsComponent implements OnInit { // this.dialogRef.close(); setTimeout(() => { this.dialogRef.close(); + this.disableAfterSubmit = false; }, 3000); } else { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; } }, error => { this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + this.disableAfterSubmit = false; }) } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts index bfe71ce2f..2a8551fcb 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts @@ -242,8 +242,6 @@ export class NeighbourHoodComponent implements OnInit { const neighbourhoodControl : FormGroup = this._neighbourhoodForm.controls['neighbourhood_list'] as FormGroup; if(formData.check_type==0){ - console.log('neighbourhoodControl',neighbourhoodControl); - // neighbourhoodControl.contdols['neighbourhood_name'].setValidators([Validators.required]); // neighbourhoodControl.controls['neighbourhood_name'].updateValueAndValidity(); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html index 47ac52c6e..aaef973c2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html @@ -56,6 +56,12 @@ formControlName="others_source"> + + + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts index d70049e4e..193103930 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts @@ -24,6 +24,8 @@ import { import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from '@angular/router'; +import { RentalInfoComponent} from './../rental-info/rental-info.component'; + @Component({ selector: 'app-other-income', templateUrl: './other-income.component.html', @@ -58,6 +60,7 @@ export class OtherIncomeComponent implements OnInit { private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, + private dialog: MatDialog, private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { @@ -154,6 +157,7 @@ public viewerOptions: any = { return this.fb.group({ source: [''], others_source : [''], + address : [''], income_earned_by:[''], others_income_earned_by:[''], amount: [''], @@ -246,5 +250,30 @@ public viewerOptions: any = { inWords(e,i){ this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); } + + Toview(){ + alert('Rental Info '); + // const dialogRef = this.dialog.open(RentalInfoComponent, { + // data: {} + // }); + + // dialogRef.afterClosed() + // .subscribe(dataresult => { + + // }); + const dialogRef = this.dialog.open(RentalInfoComponent, { + data: this.pd_all_details, + maxWidth: '100vw', + maxHeight: '100vh', + height: '100%', + width: '100%', + disableClose: true + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + // this.getCompanyListForBusiness(); + }); + + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html index 8a45db85a..1c1eabe67 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/rental-info/rental-info.component.html @@ -5,6 +5,7 @@ {{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}}
{{pageTitle}}
--> +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index d33f1119e..42ac54c0c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -138,16 +138,30 @@ export class StockComponent implements OnInit { } public initstockForms(record){ - + // console.log('record.from_business',record.from_business); let api = Object.keys(record.from_business).map(function (key) { return record.from_business[key]; }); + // console.log(api); let type2 = record.from_business.filter(data => data.type_of_activity_id == 2); - let type2length = type2[0].products ? type2[0].products.length : 0; + // console.log('type2[0].hasOwnProperty("products")',type2[0].hasOwnProperty("products")); + // console.log('type2',type2); + // console.log('type2 0 index',type2[0]); + // console.log('type2 product',type2[0].product); + // console.log('type2 length',type2[0].product.length); + + let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0; let type3 = record.from_business.filter(data => data.type_of_activity_id == 3); - let type3length = type3[0].products ? type2[0].products.length : 0; + let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0; let type4 = record.from_business.filter(data => data.type_of_activity_id == 4); - let type4length = type4[0].products ? type2[0].products.length : 0; + let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0; + + // console.log(type2); + // console.log(type2length); + // console.log(type3); + // console.log(type3length); + // console.log(type4); + // console.log(type4length); let rm_api = record.from_supplier; @@ -319,11 +333,14 @@ export class StockComponent implements OnInit { manufacturingFormCreation(record) { let arr = record.from_business.filter(data => data.type_of_activity_id == 2); + let arrlength = arr[0].hasOwnProperty("products") ? arr[0].products.length : 0; let rm_arr = record.from_supplier; - // let rm_arr = 0; - this.manufacturingForm = true; - if(arr.length > 0){ + // console.log('manu arr',arr); + // console.log('rm_arr',rm_arr); + // let rm_arr = 0; + if(arrlength > 0){ + this.manufacturingForm = true; return this.fb.group({ manufacturing_raw_materials: this.fb.array([]), is_sufficiant_raw: [], @@ -331,9 +348,8 @@ export class StockComponent implements OnInit { manufacturing_finished_goods: this.fb.array([]), }) } - - else { - return; + else { + return; } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts index b886b1229..abf5bb447 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts @@ -65,9 +65,9 @@ export class SupplierInfoComponent implements OnInit { this.notifier = notifier; this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ; this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; - this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; - this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; - this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; + this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; + this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; } public viewerOptions: any = { @@ -183,19 +183,33 @@ export class SupplierInfoComponent implements OnInit { // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { // return dataForm.main_raw_materials[key]; // }); - let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; - - this.initManufacturingProductsDetails(api_main_raw_materials); - this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null); + if(dataForm.manufacturing_details[0] !== null){ + let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; + + this.initManufacturingProductsDetails(api_main_raw_materials); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null); + } + else{ + this.initManufacturingProductsDetails(null); + this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); + } } + let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id ==4); + if(arr1.length > 0) { + if(dataForm.trade_details[0] !== null){ // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { // return dataForm.trading_products[key]; // }); let api_trading_products = dataForm.trade_details[0].trading_products; this.initTradingProductsDetails(api_trading_products); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null); + } + else{ + this.initTradingProductsDetails(null); + this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); + } } this.noRecordsFound = true; } else { @@ -213,7 +227,7 @@ export class SupplierInfoComponent implements OnInit { this.initManufacturingProductsDetails(null); this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); } - let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4); + let arr1 = record.filter(data => data.type_of_activity_id == 3 || 4); if(arr1.length > 0) { this.initTradingProductsDetails(null); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null); 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 b8d292d2f..182b5f0d0 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 @@ -92,17 +92,33 @@
-
-
-
- - -
-
- {{master.addressline1}},
{{master.city_name}},
{{master.state_name}}-{{master.pincode_id == 1 ? master.other_pincode : master.pincode }}
-
-
-
+ + + +
+
+
+
+ + +
+
+ + {{addresses.addressline1}},
{{addresses.city_name}},
{{addresses.state_name}}-{{addresses.pincode_id == 1 ? addresses.other_pincode : addresses.pincode }}
+
+
+
+
+
business Income Business Income {{element.business_income_item}} Total of Income