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 @@ + + + + + +