feat: add server-side pagination, sort and search to groups component (#507)
- Add server-side pagination, sort and search to groups component - Refactor code to conform to current guidelines See: #234
This commit is contained in:
@@ -1,51 +1,55 @@
|
||||
<div class="container m-t-40 m-b-40">
|
||||
<mat-card class="container">
|
||||
<div fxLayout="row" fxLayoutAlign="start center">
|
||||
<div class="search-box">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Search by Name" [formControl]="name">
|
||||
</mat-form-field>
|
||||
<mat-checkbox #showClosedGroups labelPosition="after" (change)="changeShowClosedGroups()">Show Closed Groups</mat-checkbox>
|
||||
</div>
|
||||
<div class="action-button" fxLayoutGap="25px">
|
||||
<button mat-raised-button color="primary">
|
||||
<fa-icon icon="plus"></fa-icon> Create Group
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-form-field class="filter">
|
||||
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
|
||||
</mat-form-field>
|
||||
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header='name'> Name </th>
|
||||
<td mat-cell *matCellDef="let row"> {{row?.name}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="accountno">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header='accountno'> Account # </th>
|
||||
<td mat-cell *matCellDef="let row"> {{row?.accountNo}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Account no Column -->
|
||||
<ng-container matColumnDef="externalid">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header='externalid'> ExternalID </th>
|
||||
<td mat-cell *matCellDef="let row"> {{row?.externalId}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- External ID Column -->
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header='status'> Status </th>
|
||||
<td mat-cell *matCellDef="let row"> <div [className]="row.active === true ? 'active' : 'inactive'">
|
||||
<i class="fa fa-circle fa-2x"> </i>
|
||||
</div> </td>
|
||||
|
||||
</ng-container>
|
||||
|
||||
<!-- Status Column -->
|
||||
<ng-container matColumnDef="office">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header='office'> Office </th>
|
||||
<td mat-cell *matCellDef="let row"> {{row?.officeName}} </td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[ ]">
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25, 100]"></mat-paginator>
|
||||
</div>
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
|
||||
<td mat-cell *matCellDef="let group"> {{ group.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="accountNo">
|
||||
<th mat-header-cell *matHeaderCellDef> Account # </th>
|
||||
<td mat-cell *matCellDef="let group"> {{ group.accountNo }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="externalId">
|
||||
<th mat-header-cell *matHeaderCellDef> ExternalID </th>
|
||||
<td mat-cell *matCellDef="let group"> {{ group.externalId }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef> Status </th>
|
||||
<td mat-cell *matCellDef="let row">
|
||||
<div [ngClass]="row.active|statusLookup">
|
||||
<fa-icon icon="stop"></fa-icon>
|
||||
</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="officeName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Office Name </th>
|
||||
<td mat-cell *matCellDef="let group"> {{ group.officeName }} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[ ]"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [length]="dataSource?.records$ | async" [pageSize]="10" [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
|
||||
</mat-card>
|
||||
|
||||
Reference in New Issue
Block a user