From 92fbcbfd6ade1c5fe0cc3c37d6a6914ef1d2a2a4 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 20:04:33 -0400 Subject: Add skip to first / last page in pagination --- ufund-ui/src/app/app.component.ts | 4 +++- .../app/components/need-list/need-list.component.css | 4 ++++ .../app/components/need-list/need-list.component.html | 8 ++++---- .../app/components/need-list/need-list.component.ts | 19 +++++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 2f98334..bc0e71a 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -3,7 +3,7 @@ import {BehaviorSubject} from 'rxjs'; import { DOCUMENT } from '@angular/common'; import {AuthService} from './services/auth.service'; import {ToastsService} from './services/toasts.service'; -import {User} from './models/User'; +import {User, userType} from './models/User'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ @@ -48,4 +48,6 @@ export class AppComponent implements OnInit { localStorage.removeItem("credential") location.reload() } + + protected readonly userType = userType; } diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 5f2e5e1..e17609b 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -89,6 +89,10 @@ select { background-color: #3a3a3a; border-radius: 5px; cursor: pointer; + height: 130px; + display: flex; + flex-direction: column; + justify-content: space-between; } .clickable:hover { diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 8d01291..88317dd 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -40,8 +40,6 @@ -
-
{{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%) @@ -65,7 +63,9 @@
- + + Page {{currentPage + 1}} of {{totalPages}} - + +
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index cd3d9bd..06a612e 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -74,12 +74,22 @@ export class NeedListComponent { decrementPage() { this.currentPage--; - this.updateVisibleNeeds(); + this.updateVisibleNeeds(); } incrementPage() { this.currentPage++; - this.updateVisibleNeeds(); + this.updateVisibleNeeds(); + } + + lastPage() { + this.currentPage = this.totalPages - 1 + this.updateVisibleNeeds() + } + + firstPage() { + this.currentPage = 0 + this.updateVisibleNeeds() } editNeedsPerPage(amount: number) { @@ -135,7 +145,7 @@ export class NeedListComponent { ngOnInit(): void { this.refresh() - + } changeSortMode(form : any) { @@ -269,7 +279,4 @@ export class NeedListComponent { } } } -function not(location: string) { - throw new Error('Function not implemented.'); -} -- cgit v1.2.3