@@ -0,0 +1,25 @@
|
||||
<div fxLayout="row">
|
||||
<mat-form-field fxFlex="50%">
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event.target.value)">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="accountNo">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Account Number </th>
|
||||
<td mat-cell *matCellDef="let memberGroup"> {{ memberGroup.accountNo }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Group Name </th>
|
||||
<td mat-cell *matCellDef="let memberGroup"> {{ memberGroup.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25]" showFirstLastButtons></mat-paginator>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MemberGroupsComponent } from './member-groups.component';
|
||||
|
||||
describe('MemberGroupsComponent', () => {
|
||||
let component: MemberGroupsComponent;
|
||||
let fixture: ComponentFixture<MemberGroupsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MemberGroupsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MemberGroupsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-member-groups',
|
||||
templateUrl: './member-groups.component.html',
|
||||
styleUrls: ['./member-groups.component.scss']
|
||||
})
|
||||
export class MemberGroupsComponent implements OnInit {
|
||||
|
||||
/** Columns to be displayed in the member groups table. */
|
||||
displayedColumns: string[] = ['accountNo', 'name'];
|
||||
/** Data source for member groups table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for member groups table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for member groups table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
/** Member Group Data Setter */
|
||||
@Input() set memberGroupData(data: any) {
|
||||
this.dataSource = new MatTableDataSource(data);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
constructor() { }
|
||||
|
||||
/**
|
||||
* Filters data in member groups table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user