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