made fixes to imports and supplier list

This commit is contained in:
Finn 2019-07-12 20:18:28 +01:00
parent 682cebef53
commit 17fc5b006b
4 changed files with 62 additions and 53 deletions

View file

@ -3,16 +3,12 @@ import { ApiService } from '../providers/api-service';
import { AgmCoreModule } from '@agm/core';
import { BsModalService, ModalDirective } from 'ngx-bootstrap/modal';
import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
interface SuppliersComponent {
name : string;
}
import { PaginationInstance } from 'ngx-pagination';
@Component({
templateUrl: 'suppliers.component.html',
})
export class SuppliersComponent implements OnInit, AfterViewInit {
@Input() public recurList: Array<RecurSupplierData>;
@Output() public onClick = new EventEmitter();
@Input() public categories: any;
@ -44,9 +40,11 @@ export class SuppliersComponent implements OnInit, AfterViewInit {
this.api.externalSuppliers(logPage, this.sortBy, this.sortDir).subscribe(
result => {
this.supplierList = result.suppliers;
if (this.supplierList) {
this.supplierListAvailable = true;
}
this.paginateConfig.totalItems = result.page_no;
this.paginateConfig.currentPage = logPage;
this.noTransactionList = false;
},
error => {
console.log('Retrieval Error');
@ -59,7 +57,7 @@ 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';