refactor(clients): clients list page

- use statuslookup.pipe to set styles to represent status of the client
- add button to import client and create client
- add server side pagination
- toggle show closed clients in table
This commit is contained in:
Jivjyot Singh
2019-12-01 23:20:51 +03:00
committed by Abhay Chawla
parent 6c7e8ad7ba
commit 504a14b968
13 changed files with 186 additions and 117 deletions
+30 -20
View File
@@ -1,10 +1,22 @@
<div class="container m-t-40 m-b-40">
<mat-form-field class="filter">
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
<div class="mat-elevation-z8">
<mat-card class="container">
<div fxLayout="row" fxLayoutAlign="start center">
<div class="search-box">
<mat-form-field>
<input matInput placeholder="Search">
</mat-form-field>
<mat-checkbox #showClosedAccounts labelPosition="after">Show Closed Accounts
</mat-checkbox>
</div>
<div class="action-button" fxLayoutGap="25px">
<button mat-raised-button color="primary" [routerLink]="['./import']">
<fa-icon icon="download"></fa-icon>&nbsp;&nbsp;Import Client
</button>
<button mat-raised-button color="primary" [routerLink]="['./add']">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;Create Client
</button>
</div>
</div>
<div>
<table mat-table [dataSource]="dataSource" matSort>
<!-- Name Column -->
@@ -25,16 +37,14 @@
<td mat-cell *matCellDef="let row"> {{row.externalId}} </td>
</ng-container>
<!-- Status Column -->
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef mat-sort-header='active'> Status </th>
<td mat-cell *matCellDef="let row">
<div [className]="row.active === true ? 'active' : 'inactive'">
<i class="fa fa-circle fa-2x"> </i>
<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>
</td>
</ng-container>
<!-- Mobile Number Column-->
@@ -42,11 +52,11 @@
<th mat-header-cell *matHeaderCellDef mat-sort-header> Mobile Number </th>
<td mat-cell *matCellDef="let client"> {{ client.mobileNo }} </td>
</ng-container>
<!--Gender column-->
<ng-container matColumnDef="gender">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Gender </th>
<td mat-cell *matCellDef="let client" > {{ client.gender.name }} </td>
<th mat-header-cell *matHeaderCellDef> Gender </th>
<td mat-cell *matCellDef="let client"> {{ client.gender.name }} </td>
</ng-container>
<!-- Color Column -->
@@ -64,11 +74,11 @@
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[row.id,'general']">
</tr>
</table>
<mat-paginator [pageSizeOptions]="[10, 25, 100]"></mat-paginator>
<mat-paginator [length]="dataSource?.records$ | async" [pageSize]="10" [pageSizeOptions]="[10, 25, 50, 100]"
showFirstLastButtons></mat-paginator>
</div>
</div>
</mat-card>