This commit is contained in:
venbatechnologies@gmail.com 2018-12-14 13:29:16 +05:30
commit 972c7b4b7b
3 changed files with 16 additions and 11 deletions

View File

@ -5,13 +5,15 @@
</form> </form>
<div *ngIf="listOfBranch.length > 0"> <div *ngIf="listOfBranch.length > 0">
<mat-list role="list" class="inlist"> <mat-list role="list" class="inlist">
<mat-list-item role="listitem" *ngFor="let branch of listOfBranch; let i = index;" class="list-item" [ngStyle]="{ 'border-color': i === currentElement ? '#f44336' : 'gray'}"> <ng-container *ngFor="let branch of listOfBranch; let i = index;">
<mat-list-item role="listitem" *ngIf="branch.isactive == 1" class="list-item" [ngStyle]="{ 'border-color': i === currentElement ? '#f44336' : 'gray'}">
<label style="width: 80%" [hidden]="currentElement === i">{{branch.branch_name}}</label> <label style="width: 80%" [hidden]="currentElement === i">{{branch.branch_name}}</label>
<input *ngIf="currentElement === i" matInput placeholder="Add Branch" [(ngModel)]="branch.branch_name"> <input *ngIf="currentElement === i" matInput placeholder="Add Branch" [(ngModel)]="branch.branch_name">
<span (click)="editItem(i)" [hidden]="currentElement === i"><mat-icon>edit</mat-icon></span> <span (click)="editItem(i)" [hidden]="currentElement === i"><mat-icon>edit</mat-icon></span>
<span (click)="editItem(-1)" *ngIf="currentElement === i"><mat-icon>check</mat-icon></span> <span (click)="editItem(-1)" *ngIf="currentElement === i"><mat-icon>check</mat-icon></span>
<span (click)="deleteItem(i)"><mat-icon>delete</mat-icon></span> <span (click)="deleteItem(branch, i)"><mat-icon>delete</mat-icon></span>
</mat-list-item> </mat-list-item>
</ng-container>
</mat-list> </mat-list>
<div class="row" style="text-align:right;"> <div class="row" style="text-align:right;">

View File

@ -90,9 +90,13 @@ export class EntityBranchAddComponent implements OnInit {
this.currentElement = i; this.currentElement = i;
} }
deleteItem(i): void { deleteItem(obj, i): void {
if (obj.entity_lender_branch_id !== null) {
obj.isactive = 0;
} else {
this.listOfBranch.splice(i, 1); this.listOfBranch.splice(i, 1);
} }
}
saveBranch(): void { saveBranch(): void {
this.entityService.updateEntityIdBranchInfoDetails(this.listOfBranch).subscribe(data => { this.entityService.updateEntityIdBranchInfoDetails(this.listOfBranch).subscribe(data => {
@ -112,7 +116,6 @@ export class EntityBranchAddComponent implements OnInit {
} }
} }
// "records": [ // "records": [
// { // {
// "entity_lender_branch_id": null, // "entity_lender_branch_id": null,

View File

@ -240,7 +240,7 @@
</app-entity-edit-tat> </app-entity-edit-tat>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
<mat-tab label="Branch"> <mat-tab *ngIf="localEntityType == 2" label="Branch">
<ng-template matTabContent> <ng-template matTabContent>
<app-entity-branch-add [entityId]="entity_id"> <app-entity-branch-add [entityId]="entity_id">
</app-entity-branch-add> </app-entity-branch-add>