diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html index bcdace6ad..4aab1bb4c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html @@ -99,12 +99,12 @@ formControlName="applicant_name" required> {{owner.applicant_name}} - Others + - + + formControlName="other_applicant" autocomplete="off"> - + 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..93daffb4d 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, @@ -46,6 +47,7 @@ export class BankingDetailsComponent implements OnInit { this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase(); this.pd_cus_segment = this.pd_cus_segment.substring(0,3); this.applicants = this.pd_all_details.pdapplicants_detials; + this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); this.notifier = notifier; } @@ -57,6 +59,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 +127,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 +193,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 +213,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 e24f3f29d..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 @@ -17,13 +17,13 @@
- - + + {{"₹"}} {{loanAmtInWords}} Only - - - {{ enduse.name }} + + + {{ enduse.name }} - - + + - + + formControlName="is_transfer" required > Yes No - - - +
+ + {{"₹"}} {{balTxrfAmtInWords}} Only - + Yes No - + - {{ btLen.lender_name }} + {{ btLen.lender_name }} + + - + + - - - - - + + + {{"₹"}} {{topUpAmtInWords}} Only +
+
- - + + {{"₹"}} {{ownContributionInWords}} Only - + {{ sour.name }} - - - - - - - - + + + + + + + +
+ + + + +

Mortgage

@@ -125,7 +133,7 @@
--> - + - + @@ -147,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.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..517aad7ac --- /dev/null +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-branch-add/entity-branch-add.component.ts @@ -0,0 +1,245 @@ +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: any= {}; + public listofCity = []; + public listOfBranch = []; + + public m_city: any = []; + + public _addEntityBranchFrom: FormGroup; + public submitted = false; + + /** +* Notifier service +*/ + private notifier: NotifierService; + + constructor( + notifier: NotifierService, + private entityService: EntityService, + 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.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 = [ + // { + // "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(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; + editItem(i): void { + this.currentElement = i; + } + + deleteItem(obj, i): void { + if (obj.entity_lender_branch_id !== null) { + obj.isactive = 0; + } else { + this.listOfBranch.splice(i, 1); + } + } + + /** 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 { +// 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 { + 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..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,6 +234,12 @@ + + + + + + diff --git a/ng6-seed/src/app/settings/entity/entity.module.ts b/ng6-seed/src/app/settings/entity/entity.module.ts index a6a5d04e7..74a14169f 100755 --- a/ng6-seed/src/app/settings/entity/entity.module.ts +++ b/ng6-seed/src/app/settings/entity/entity.module.ts @@ -38,6 +38,7 @@ import { EntityEditBillingInfoComponent } from './entity-edit/entity-edit-billin import { DialogAddEditBillingInfo } from './entity-edit/entity-edit-billing-info/entity-edit-billing-info.component'; import { EntityEditVendorCityInfoComponent } from './entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component'; +import { EntityBranchAddComponent } from './entity-edit/entity-branch-add/entity-branch-add.component'; // import { MatTooltipModule } from '@angular/material/tooltip'; /** * Custom angular notifier options @@ -115,7 +116,8 @@ const customNotifierOptions: NotifierOptions = { EntityEditPriceComponent, EntityEditBillingInfoComponent, DialogAddEditBillingInfo, - EntityEditVendorCityInfoComponent + EntityEditVendorCityInfoComponent, + EntityBranchAddComponent ], entryComponents: [ EntityEditComponent, diff --git a/ng6-seed/src/app/settings/service/entity/entity.service.ts b/ng6-seed/src/app/settings/service/entity/entity.service.ts index eb5ca70f8..1a859a99f 100755 --- a/ng6-seed/src/app/settings/service/entity/entity.service.ts +++ b/ng6-seed/src/app/settings/service/entity/entity.service.ts @@ -164,6 +164,22 @@ export class EntityService { return this._http.post(this.apiUrl + "saveVendorCityMapping", {'records': Records }); } + + getEntityBranchList(entity_id: any): Observable { +// Add safe, URL encoded search parameter if there is a search term + const options = entity_id ? + { params: new HttpParams().set('entityid', entity_id) } : {}; + + return this._http.get(this.apiUrl + "listLenderBranches", options); + } + + updateEntityIdBranchInfoDetails(Records: any): Observable{ + Records.map(data=>{ + data.fk_updatedby = data.fk_createdby == null ? null : this._aws.getlocale(); + data.fk_createdby = data.fk_createdby == null ? this._aws.getlocale() : data.fk_createdby; + }) + return this._http.post(this.apiUrl + "saveLenderBranches", {'records': Records }); + } /**