Amended supplier list
This commit is contained in:
parent
40462b7d8f
commit
8202cdfdb1
3 changed files with 30 additions and 6 deletions
|
@ -18,6 +18,8 @@ export class SuppliersComponent implements OnInit, AfterViewInit {
|
|||
|
||||
supplierList: any;
|
||||
supplierListAvailable = false;
|
||||
sortBy = 'name';
|
||||
sortDir = 'asc';
|
||||
|
||||
public paginateConfig: PaginationInstance = {
|
||||
id: 'transpaginate',
|
||||
|
@ -39,7 +41,7 @@ export class SuppliersComponent implements OnInit, AfterViewInit {
|
|||
}
|
||||
|
||||
loadSuppliers(logPage: number) {
|
||||
this.api.externalSuppliers(logPage).subscribe(
|
||||
this.api.externalSuppliers(logPage, this.sortBy, this.sortDir).subscribe(
|
||||
result => {
|
||||
this.supplierList = result.suppliers;
|
||||
this.paginateConfig.totalItems = result.page_no;
|
||||
|
@ -53,6 +55,17 @@ export class SuppliersComponent implements OnInit, AfterViewInit {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
sortName() { this.sortByColumn('name'); }
|
||||
sortPostcode() { this.sortByColumn('postcode'); }
|
||||
sortSpend() { this.sortByColumn('spend'); }
|
||||
|
||||
sortByColumn(name) {
|
||||
this.sortBy = name;
|
||||
this.sortDir = this.sortDir === 'asc' ? 'desc' : 'asc';
|
||||
this.loadSuppliers(1);
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue