refractor(breadcrumb): enhance breadcrumb (#129)
Enhance breadcrumb design and generation Fixes #106
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { SelectionModel } from '@angular/cdk/collections';
|
||||
import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
|
||||
import { UserService } from './user.service';
|
||||
|
||||
export interface User {
|
||||
name: string;
|
||||
id: number;
|
||||
email: string;
|
||||
isSelfServiceUser: boolean;
|
||||
officeName: string;
|
||||
staff: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-users',
|
||||
templateUrl: './users.component.html',
|
||||
styleUrls: ['./users.component.scss']
|
||||
})
|
||||
export class UsersComponent implements OnInit {
|
||||
|
||||
displayedColumns: string[] = ['select', 'name', 'id', 'email', 'status', 'officeName', 'staff'];
|
||||
dataSource: any;
|
||||
selection = new SelectionModel<User>(true, []);
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
constructor(private userService: UserService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.userService.getUsers().subscribe((data: User[]) => {
|
||||
this.dataSource = new MatTableDataSource(data);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
});
|
||||
}
|
||||
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
isAllSelected() {
|
||||
const numSelected = this.selection.selected.length;
|
||||
const numRows = this.dataSource.data.length;
|
||||
return numSelected === numRows;
|
||||
}
|
||||
|
||||
masterToggle() {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.data.forEach((row: User) => this.selection.select(row));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user