dashboard recent-activity bug fix

This commit is contained in:
Sofia Papacharalampous 2024-05-23 17:32:44 +03:00
parent 1941500034
commit ab4631526b
2 changed files with 4 additions and 1 deletions

View File

@ -40,7 +40,7 @@
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="listingItems && listingItems.length > 0 && listingItems.length < pageSize">
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
</div>
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= currentPage*pageSize" class="d-flex justify-content-center">
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= currentPage*pageSize && !foundLastPage" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>

View File

@ -38,6 +38,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
currentPage: number = 0;
pageSize: number = 5;
listingItems: RecentActivityItem[]= [];
foundLastPage: boolean = false; // in case the total-items-count is equal to this.pageSize*this.currentPage
@Input() type: string;
@Input() includeDescriptions: boolean = false;
@ -190,6 +191,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.listingItems = this.listingItems.slice(0, this.listingItems.length-latestBatchCount);
this._setPage(this.currentPage-1);
this.foundLastPage = false;
return;
}
@ -227,6 +229,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
private _resetPagination(): void {
if (this.listingItems.length == 0) this.currentPage = 0;
else this.currentPage = Math.ceil(this.listingItems.length/this.pageSize);
this.foundLastPage = true;
this.updateUrl();
}