From 1cb475cb9a190d02dcb506e5f1adcd9ca3fd38f7 Mon Sep 17 00:00:00 2001
From: Mazdak Gibran <141390141+mazdakgibran@users.noreply.github.com>
Date: Fri, 30 Jan 2026 12:07:36 +0500
Subject: [PATCH] Refactor pagination and fix password modal icons
Refactored transaction logs pagination by converting pagedItems to a getter and removing redundant state and methods. Fixed the password visibility toggle icons in the reset password modal and removed the minLength error message from the new password field.
---
.../transaction-logs.component.html | 2 +-
.../transaction-logs.component.ts | 24 ++++++++-----------
.../reset-password-modal.component.html | 13 ++++------
3 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/src/app/transaction-logs/transaction-logs.component.html b/src/app/transaction-logs/transaction-logs.component.html
index 6572cc2..cd98bc0 100644
--- a/src/app/transaction-logs/transaction-logs.component.html
+++ b/src/app/transaction-logs/transaction-logs.component.html
@@ -193,7 +193,7 @@
- {
@@ -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);
+}
+
}
\ No newline at end of file
diff --git a/src/app/user-management/reset-password-modal/reset-password-modal.component.html b/src/app/user-management/reset-password-modal/reset-password-modal.component.html
index 954b0b7..78d829b 100644
--- a/src/app/user-management/reset-password-modal/reset-password-modal.component.html
+++ b/src/app/user-management/reset-password-modal/reset-password-modal.component.html
@@ -58,8 +58,8 @@
(click)="togglePasswordType()"
[attr.disabled]="isSubmitting ? true : null"
>
-
+
@@ -68,10 +68,7 @@
{{ 'fieldRequired' | translate }}
-
- {{ 'passwordMinLength' | translate }}
-
-
+
{{ 'passwordMaxLength' | translate }}
@@ -105,8 +102,8 @@
(click)="toggleConfirmPasswordType()"
[attr.disabled]="isSubmitting ? true : null"
>
-
+
--
2.32.0