From fcbdc8db99336b5b0fc0cb22067a481a3da68971 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 13 Dec 2018 11:13:25 +0530 Subject: [PATCH 1/6] loan details : ps --- .../loan-details/loan-details.component.html | 72 ++++++++++--------- .../loan-details/loan-details.component.ts | 17 +++++ 2 files changed, 57 insertions(+), 32 deletions(-) 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 16887c9b9..00fa5473d 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 @@ -17,11 +17,11 @@
- - + + {{"₹"}} {{loanAmtInWords}} Only - + {{ enduse.name }} @@ -37,66 +37,74 @@ Other purpose --> - + - + + formControlName="is_transfer" required > Yes No - - - +
+ + {{"₹"}} {{balTxrfAmtInWords}} Only - + Yes No - + - {{ btLen.lender_name }} - - + {{ btLen.lender_name }} + - + + - - + + + {{"₹"}} {{topUpAmtInWords}} Only +
+
- + {{"₹"}} {{ownContributionInWords}} Only - + {{ sour.name }} - - - - - - - - + + + + + + + +
+ + + + +

Mortgage

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 1b5a1cf33..eade414cb 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 @@ -491,4 +491,21 @@ getM_sourceofamount() { } + /** + * LoanCalculation + */ + loanCalc() + { + let BtAmount = this.loanDetailsForm.value.balance_transfer_amount; + let loanAmount = this.loanDetailsForm.value.loan_amount; + let topupAmt ; + if(BtAmount !=null && BtAmount !='' && loanAmount !=null && loanAmount!='') + { + topupAmt = loanAmount - BtAmount; + //topUpAmtInWords + } + this.loanDetailsForm.controls['topup_amount'].setValue(topupAmt); + this.topUpAmtInWords = this._pd.convertNumberToWords(topupAmt); + } + } From 32f14d64215bae838b2ce9b2726bec4b8d661ac5 Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Thu, 13 Dec 2018 18:37:47 +0530 Subject: [PATCH 2/6] entity branch details added : kdk --- .../entity-branch-add.component.html | 25 ++++ .../entity-branch-add.component.scss | 14 ++ .../entity-branch-add.component.spec.ts | 25 ++++ .../entity-branch-add.component.ts | 125 ++++++++++++++++++ .../entity-edit/entity.edit.component.html | 6 + .../src/app/settings/entity/entity.module.ts | 4 +- .../settings/service/entity/entity.service.ts | 16 +++ 7 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.html create mode 100644 ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.scss create mode 100644 ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.spec.ts create mode 100644 ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.html new file mode 100644 index 000000000..4df9dc3d9 --- /dev/null +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.html @@ -0,0 +1,25 @@ +
+ + + check +
+
+ + + + + edit + check + delete + + + +
+ + +
+
+
+

No Records Found...

+
\ No newline at end of file diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.scss b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.scss new file mode 100644 index 000000000..53f8de38e --- /dev/null +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.scss @@ -0,0 +1,14 @@ +.inlist{ + display: flex; + flex-wrap: wrap; +} + +.inlist > * { + width: 350px; +} + +.list-item { + border: 1px solid gray; + margin: 2px; + border-radius: 6px; +} \ No newline at end of file diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.spec.ts b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.spec.ts new file mode 100644 index 000000000..205a0c98f --- /dev/null +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EntityBranchAddComponent } from './entity-branch-add.component'; + +describe('EntityBranchAddComponent', () => { + let component: EntityBranchAddComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ EntityBranchAddComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(EntityBranchAddComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts new file mode 100644 index 000000000..23dc8426d --- /dev/null +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts @@ -0,0 +1,125 @@ +import { Component, ViewChild, OnInit, OnDestroy, Input, Inject } from '@angular/core'; +import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material'; +import { FormGroup, FormControl, FormBuilder, Validators, FormArray } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DataSource } from '@angular/cdk/table'; +import { Observable } from 'rxjs/Observable'; + +import { NotifierService } from 'angular-notifier'; + +import { MastersService } from './../../../service/masters/masters.service'; +import { EntityService } from './../../../service/entity/entity.service'; + +@Component({ + selector: 'app-entity-branch-add', + templateUrl: './entity-branch-add.component.html', + styleUrls: ['./entity-branch-add.component.scss'] +}) +export class EntityBranchAddComponent implements OnInit { + + @Input() public entityId: number; + public newElement = { name: '' }; + public listOfBranch = []; + + /** +* Notifier service +*/ + private notifier: NotifierService; + + constructor( + notifier: NotifierService, + private entityService: EntityService, + private mastersService: MastersService, + private _formBuilder: FormBuilder) { + this.notifier = notifier; + } + + ngOnInit() { + this.entityService.getEntityBranchList(this.entityId).subscribe(data => { + if (data.dataStatus) { + this.listOfBranch = data.records; + } + }, err => { + + }) + } + + + // public listOfBranch = [ + // { + // "entity_lender_branch_id": 1, + // "branch_name": "Dev Test Branch 1", + // "isactive": "1", + // "fk_createdby": "1", + // "fk_updatedby": "1", + // "fk_entity_id": "1" + // }, + // { + // "entity_lender_branch_id": 2, + // "branch_name": "Dev Test Branch 2", + // "isactive": "1", + // "fk_createdby": "1", + // "fk_updatedby": "1", + // "fk_entity_id": "1" + // }, + // { + // "entity_lender_branch_id": 3, + // "branch_name": "Dev Test Branch 3", + // "isactive": "1", + // "fk_createdby": "1", + // "fk_updatedby": "1", + // "fk_entity_id": "1" + // } + // ]; + + addItem(): void { + let data = { + "entity_lender_branch_id": null, + "branch_name": this.newElement.name, + "isactive": "1", + "fk_createdby": null, + "fk_updatedby": null, + "fk_entity_id": this.entityId.toString() + } + this.listOfBranch.push(data); + this.newElement.name = ''; + } + + public currentElement = -1; + editItem(i): void { + this.currentElement = i; + } + + deleteItem(i): void { + this.listOfBranch.splice(i, 1); + } + + saveBranch(): void { + this.entityService.updateEntityIdBranchInfoDetails(this.listOfBranch).subscribe(data => { + if (data.dataStatus) { + this.notifier.notify('success', 'Your Changes Updated.!'); + } else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + } + }, err => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }) + } + + reset(): void { + this.listOfBranch = []; + this.ngOnInit(); + } +} + + +// "records": [ +// { +// "entity_lender_branch_id": null, +// "branch_name": "Dev Test Branch", +// "isactive": "1", +// "fk_createdby": "1", +// "fk_updatedby": "1", +// "fk_entity_id": "1" +// } +// ] \ No newline at end of file diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html index a94cc5b09..486a28bc6 100755 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html @@ -239,6 +239,12 @@ + + + + + +
- + Yes @@ -151,7 +151,7 @@ + formControlName="limit" (keypress)="keyPress($event)" required autocomplete="off">
- + - +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts index 885aba086..238832be3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts @@ -37,6 +37,7 @@ export class BankingDetailsComponent implements OnInit { public applicants: any; m_accountType= []; m_btLenderList = []; + salaryField : boolean; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, @@ -57,6 +58,8 @@ export class BankingDetailsComponent implements OnInit { this.initBankingForm(); this.getM_AccountType(); this.getM_BTLenderList(); + + this.salaryField = this.pd_cus_segment.substring(0,2) == 'SE' ? false : true ; // this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); // // console.log("(0,3): " + this.pd_cus_segment.substring(0,3)); // // console.log(this.pd_all_details.pdmaster_details); @@ -123,7 +126,8 @@ export class BankingDetailsComponent implements OnInit { bank_name: ['', Validators.compose([Validators.required])], other_bank: [''], account_type: ['', Validators.compose([Validators.required])], - salary: ['', Validators.compose([Validators.required])], + //salary: ['', Validators.compose([Validators.required])], + salary: this.pd_cus_segment.substring(0,2) == 'SE' ? [''] : ['', Validators.compose([Validators.required])], limit: ['', Validators.compose([Validators.required])], //is_main: ['', Validators.compose([Validators.required])], //is_main: [this.pd_cus_segment == 'SAL' ? '' : '', Validators.compose([Validators.required])], @@ -188,13 +192,13 @@ export class BankingDetailsComponent implements OnInit { } selectedAccTypeChanges(event: any){ - console.log('First Time',event); - console.log('First Time Value',event.value); + // console.log('First Time',event); + // console.log('First Time Value',event.value); if(event.value == 2) { const control = this.bankingForm.controls['itemRows']; - console.log('Inside If Condition'); - console.log(control); - console.log(control.controls); + // console.log('Inside If Condition'); + // console.log(control); + // console.log(control.controls); control.controls[0].get('limit').clearValidators(); control.controls[0].get('limit').updateValueAndValidity(); @@ -208,7 +212,7 @@ export class BankingDetailsComponent implements OnInit { } else{ - alert('sd'); + //alert('sd'); } } 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 e8d72e1a7..c173c61fd 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 @@ -18,12 +18,12 @@
- + {{"₹"}} {{loanAmtInWords}} Only - - {{ enduse.name }} + + {{ enduse.name }} - +
- + {{"₹"}} {{balTxrfAmtInWords}} Only @@ -67,18 +67,18 @@ - + - + {{"₹"}} {{topUpAmtInWords}} Only
- + {{"₹"}} {{ownContributionInWords}} Only @@ -96,14 +96,14 @@ - +
- + @@ -133,7 +133,7 @@
--> - + - + @@ -155,7 +155,7 @@ + formControlName="percentage_of_construction" (keypress)="keyPress($event)" required autocomplete="off"> + +
+
+ + +
+
+ + + Branch Name Required.! + + + + + {{ city.name }} + + City Required.! + +
+ + + +
+
+
+
+
+
+
+ + + + +
+
diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts index a6b927778..517aad7ac 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts @@ -18,9 +18,15 @@ import { EntityService } from './../../../service/entity/entity.service'; export class EntityBranchAddComponent implements OnInit { @Input() public entityId: number; - public newElement = { name: '' }; + public newElement: any= {}; + public listofCity = []; public listOfBranch = []; + public m_city: any = []; + + public _addEntityBranchFrom: FormGroup; + public submitted = false; + /** * Notifier service */ @@ -32,18 +38,89 @@ export class EntityBranchAddComponent implements OnInit { private mastersService: MastersService, private _formBuilder: FormBuilder) { this.notifier = notifier; + this._addEntityBranchFrom = this._formBuilder.group({ + branch_details: this._formBuilder.array([ + // this.addRegionFormData(null, null), + ]) + }) } ngOnInit() { this.entityService.getEntityBranchList(this.entityId).subscribe(data => { if (data.dataStatus) { - this.listOfBranch = data.records; + this.listofCity = data.records; + this.m_city = data.records.city_master; + // this.listOfBranch = data.records; + this.setFormDatas(data.records.branch_details); } }, err => { - }) } + setFormDatas(record) { + if (record.length > 0) { + for (let val of record) { + let vals = { + entity_lender_branch_id: val.entity_lender_branch_id, + branch_name: val.branch_name, + fk_entity_id: val.fk_entity_id, + fk_region_id: val.fk_region_id, + fk_city_id: val.fk_city_id, + fk_updatedby: val.fk_updatedby, + fk_createdby: val.fk_createdby, + isactive: val.isactive, + }; + this.addRegionFormData(vals, null); + } + } + } + + // convenience getter for easy access to form fields + get f() { return this._addEntityBranchFrom.controls; } + + // Dynamic Form field creation Functionality : START ===> + initRegionFormLoad(data) { + return this._formBuilder.group({ + entity_lender_branch_id: [data.entity_lender_branch_id], + branch_name: [data.branch_name, Validators.compose([Validators.required])], + fk_city_id: [data.fk_city_id, Validators.compose([Validators.required])], + fk_entity_id: [data.fk_entity_id], + fk_updatedby: [data.fk_updatedby], + fk_createdby: [data.fk_createdby], + isactive: [data.isactive], + }); + } + addRegionFormData(data, e) { + if (data == null) { + let newDate = { + entity_lender_branch_id: null, + branch_name:null, + fk_entity_id: this.entityId, + fk_createdby: null, + fk_updatedby: null, + fk_city_id: null, + isactive: 1, + } + const control = this._addEntityBranchFrom.controls['branch_details']; + control.push(this.initRegionFormLoad(newDate)); + } else { + const control = this._addEntityBranchFrom.controls['branch_details']; + control.push(this.initRegionFormLoad(data)); + } + } + + deleteEntityBranch(inx, e) { + e.stopPropagation(); + const control = this._addEntityBranchFrom.controls['branch_details']; + // let dataS = control.controls[inx].value; + if(control.controls[inx].value['entity_lender_branch_id'] !== null){ + console.log( this._addEntityBranchFrom.controls['branch_details']['controls'][inx].controls.isactive); + this._addEntityBranchFrom.controls['branch_details']['controls'][inx].controls.isactive.setValue("0"); + console.log( this._addEntityBranchFrom.controls['branch_details']['controls'][inx].controls.isactive.value); + } else { + control.removeAt(inx); + } + } // public listOfBranch = [ // { @@ -72,17 +149,17 @@ export class EntityBranchAddComponent implements OnInit { // } // ]; - addItem(): void { - let data = { - "entity_lender_branch_id": null, - "branch_name": this.newElement.name, - "isactive": "1", - "fk_createdby": null, - "fk_updatedby": null, - "fk_entity_id": this.entityId.toString() - } - this.listOfBranch.push(data); - this.newElement.name = ''; + addItem(prop): void { + // let data = { + // "entity_lender_branch_id": null, + // "branch_name": this.newElement.name, + // "isactive": "1", + // "fk_createdby": null, + // "fk_updatedby": null, + // "fk_entity_id": this.entityId.toString() + // } + // this.listOfBranch.push(data); + // this.newElement.name = ''; } public currentElement = -1; @@ -98,8 +175,48 @@ export class EntityBranchAddComponent implements OnInit { } } + /** To Save/Edited Popup Data */ + onSubmit() { + alert(); + this.submitted = true; + // stop here if form is invalid + if (this._addEntityBranchFrom.invalid) { + // this.errorMessage = "Please Fill All Mandate Fields."; + return; + } else { + var formValues = this._addEntityBranchFrom.value; + //To Remove The "Null" With Key also + Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]); + alert(JSON.stringify(formValues.branch_details)); + // this.entityService.updateEntityIdRegionInfoDetails(formValues.region_lender).subscribe( + // dataresult => { + // if (dataresult.status == 200) { + // console.log(dataresult); + // this.notifier.notify('success', 'Your Changes Updated.!'); + // const arr = this._editEntityRegionFrom.controls.region_lender; + // arr.controls.splice(0); + // // this.getEntityIDRegionInfoDetails(); + // } + // else { + // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + // // this.errorMessage = "Something Wents Wrong Try Again.!"; + // } + // }, error => { + // this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + // // this.errorMessage = "Some Thing Wents Wrong Try Again.!"; + // }); + } + } + + saveBranch(): void { - this.entityService.updateEntityIdBranchInfoDetails(this.listOfBranch).subscribe(data => { +// alert(); + var formValues = this._addEntityBranchFrom.value; + //To Remove The "Null" With Key also + Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]); + // alert(JSON.stringify(formValues.branch_details)); + + this.entityService.updateEntityIdBranchInfoDetails(formValues.branch_details).subscribe(data => { if (data.dataStatus) { this.notifier.notify('success', 'Your Changes Updated.!'); } else { diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html index 90a324cf4..17b31563b 100755 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html @@ -234,18 +234,18 @@ - - - - - - + + + + + +