|
|
|
|
@ -29,7 +29,6 @@ export class TransactionLogsComponent implements OnInit, OnDestroy {
|
|
|
|
|
itemsPerPage: number = 10;
|
|
|
|
|
transactionLog: TransactionLog[] = [];
|
|
|
|
|
isLoading = false;
|
|
|
|
|
pagedItems: any[] = [];
|
|
|
|
|
errorMessage: string = '';
|
|
|
|
|
searchText: string = '';
|
|
|
|
|
allItems: TransactionLog[] = [];
|
|
|
|
|
@ -134,8 +133,7 @@ export class TransactionLogsComponent implements OnInit, OnDestroy {
|
|
|
|
|
} else {
|
|
|
|
|
this.totalCount = this.transactionLog.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.updatePagedItems();
|
|
|
|
|
|
|
|
|
|
this.isLoading = false;
|
|
|
|
|
},
|
|
|
|
|
error: (err) => {
|
|
|
|
|
@ -144,7 +142,6 @@ export class TransactionLogsComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.transactionLog = [];
|
|
|
|
|
this.allItems = [];
|
|
|
|
|
this.totalCount = 0;
|
|
|
|
|
this.pagedItems = [];
|
|
|
|
|
this.isLoading = false;
|
|
|
|
|
},
|
|
|
|
|
complete: () => {
|
|
|
|
|
@ -252,8 +249,9 @@ export class TransactionLogsComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalPages(): number {
|
|
|
|
|
return Math.ceil(this.totalCount / this.itemsPerPage);
|
|
|
|
|
}
|
|
|
|
|
if (this.totalCount === 0) return 1;
|
|
|
|
|
return Math.ceil(this.totalCount / this.itemsPerPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
previousPage(): void {
|
|
|
|
|
if (this.currentPage > 1) {
|
|
|
|
|
@ -262,14 +260,6 @@ export class TransactionLogsComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatePagedItems(): void {
|
|
|
|
|
// For client-side display with table filter pipe
|
|
|
|
|
const startIndex = (this.currentPage - 1) * this.itemsPerPage;
|
|
|
|
|
const endIndex = startIndex + this.itemsPerPage;
|
|
|
|
|
|
|
|
|
|
this.pagedItems = this.allItems.slice(startIndex, endIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nextPage(): void {
|
|
|
|
|
if (this.currentPage < this.totalPages()) {
|
|
|
|
|
this.currentPage++;
|
|
|
|
|
@ -341,4 +331,10 @@ export class TransactionLogsComponent implements OnInit, OnDestroy {
|
|
|
|
|
get isDateFilterActive(): boolean {
|
|
|
|
|
return !!this.fromDate || !!this.toDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get pagedItems(): TransactionLog[] {
|
|
|
|
|
const start = (this.currentPage - 1) * this.itemsPerPage;
|
|
|
|
|
return this.allItems.slice(start, start + this.itemsPerPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|