feat: add groups view page (committee-tab) (#790)

Fixes: #779
This commit is contained in:
Karan Takalkar
2020-05-20 19:29:15 +05:30
committed by GitHub
parent 67b766e61f
commit fd2c5f61ac
12 changed files with 151 additions and 51 deletions
@@ -0,0 +1,49 @@
<div class="tab-container mat-typography">
<div fxLayout="row" fxLayoutAlign="start" class="table-header">
<div class="m-b-10">
<h3>Client Members</h3>
</div>
<div class="action-button m-b-10" fxLayoutGap="25px" *ngIf="groupStatus !== 'Closed'">
<button mat-raised-button class="f-right" color="primary"
*mifosxHasPermission="'ASSIGNROLE_GROUP'">
<i class="fa fa-plus"></i>&nbsp; Add</button>
</div>
</div>
<table mat-table [dataSource]="groupRolesData"
class="mat-elevation-z1">
<ng-container matColumnDef="Name">
<th mat-header-cell *matHeaderCellDef> Name </th>
<td mat-cell *matCellDef="let element"> {{element.clientName}} </td>
</ng-container>
<ng-container matColumnDef="Role">
<th mat-header-cell *matHeaderCellDef> Role </th>
<td mat-cell *matCellDef="let element"> {{element.role.name}} </td>
</ng-container>
<ng-container matColumnDef="Client Id">
<th mat-header-cell *matHeaderCellDef> Client Id </th>
<td mat-cell *matCellDef="let element"> {{element.clientId}} </td>
</ng-container>
<ng-container matColumnDef="Actions">
<th mat-header-cell *matHeaderCellDef> Actions </th>
<td mat-cell *matCellDef="let element">
<span *ngIf="groupStatus !== 'Closed'">
<button class="account-action-button" mat-raised-button color="primary"
*mifosxHasPermission="'UNASSIGNROLE_GROUP'">
<i class="fa fa-ban" matTooltip="Unassign"></i>
</button>
</span>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="groupRolesColumns"></tr>
<tr mat-row *matRowDef="let row; columns: groupRolesColumns;"></tr>
</table>
</div>
@@ -0,0 +1,22 @@
.tab-container {
padding: 1%;
margin: 1%;
h3 {
margin:1% auto;
}
.table-header {
.action-button{
margin-left: auto;
}
}
table {
width: 100%;
margin-bottom: 30px;
.account-action-button{
min-width: 26px;
padding: 0 6px;
margin: 4px;
line-height: 25px;
}
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommitteeTabComponent } from './committee-tab.component';
describe('CommitteeTabComponent', () => {
let component: CommitteeTabComponent;
let fixture: ComponentFixture<CommitteeTabComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CommitteeTabComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CommitteeTabComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,33 @@
/** Angular Imports */
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
/**
* Groups Committee Tab Component
*/
@Component({
selector: 'mifosx-committee-tab',
templateUrl: './committee-tab.component.html',
styleUrls: ['./committee-tab.component.scss']
})
export class CommitteeTabComponent {
/** Group Status */
groupStatus: any;
/** Group Roles Data */
groupRolesData: any;
/** Columns to be Displayed for client members table */
groupRolesColumns: string[] = ['Name', 'Role', 'Client Id', 'Actions'];
/**
* Fetches groups data from parent's `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { groupViewData: any }) => {
this.groupRolesData = data.groupViewData.groupRoles;
this.groupStatus = data.groupViewData.status.value;
});
}
}
@@ -47,7 +47,9 @@ export class GeneralTabComponent {
this.savingAccounts = data.groupAccountsData.savingsAccounts;
this.loanAccounts = data.groupAccountsData.loanAccounts;
this.groupSummary = data.groupSummary[0];
this.groupClientMembers = data.groupClientMembers;
});
this.route.parent.data.subscribe((data: { groupViewData: any }) => {
this.groupClientMembers = data.groupViewData.clientMembers;
});
}
@@ -100,10 +100,14 @@
[active]="general.isActive">
General
</a>
<a mat-tab-link [routerLink]="['./notes']" routerLinkActive #notes="routerLinkActive"
<a mat-tab-link [routerLink]="['./notes']" *mifosxHasPermission="'READ_GROUPNOTE'" routerLinkActive #notes="routerLinkActive"
[active]="notes.isActive">
Notes
</a>
<a mat-tab-link [routerLink]="['./committee']" routerLinkActive #committee="routerLinkActive"
[active]="committee.isActive">
Committee
</a>
</nav>
<router-outlet></router-outlet>
@@ -9,7 +9,7 @@
<textarea formControlName="note" matInput placeholder="Write a note ...."></textarea>
</mat-form-field>
<button mat-raised-button fxFlex color="primary" [disabled]="!noteForm.valid">
<button mat-raised-button fxFlex color="primary" *mifosxHasPermission="'CREATE_GROUPNOTE'" [disabled]="!noteForm.valid">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp; Add
</button>