diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 16:49:21 -0400 | 
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 16:49:21 -0400 | 
| commit | 8b64b8bd43f987b924d74d0ea597b7b606ca9357 (patch) | |
| tree | c8c3229c54955a4a037b0ce0a016221e8784af42 /ufund-ui/src/app/components/dashboard | |
| parent | bb4e0e55fee7ec8f34c36e6299301d612a0de2ce (diff) | |
| parent | 7635188ed6182a72facd8ab3299f13c7217a8abd (diff) | |
| download | JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.tar.gz JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.tar.bz2 JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.zip  | |
Merge branch 'main' into light-mode
# Conflicts:
#	ufund-ui/src/styles.css
Diffstat (limited to 'ufund-ui/src/app/components/dashboard')
| -rw-r--r-- | ufund-ui/src/app/components/dashboard/dashboard.component.html | 6 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/dashboard/dashboard.component.ts | 10 | 
2 files changed, 14 insertions, 2 deletions
diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.html b/ufund-ui/src/app/components/dashboard/dashboard.component.html index 233096a..20e1676 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.html +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.html @@ -21,6 +21,12 @@              <span>Most fulfilled needs</span>              <app-mini-need-list [needList]="mostFulfilledNeeds.getValue()" label="Most fulfilled"> </app-mini-need-list>          </div> +        <div class="listCard"> +            <span>Total physical contributions</span> +            <ul> +                <li id="physicalContent" *ngFor="let need of physicalTotal">{{need}} </li> +            </ul> +        </div>      } @else {          <h1>Unauthorized</h1> diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.ts index 2ab4db2..b73be44 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.ts +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.ts @@ -16,10 +16,11 @@ import {userType} from '../../models/User';  export class DashboardComponent implements OnInit{      protected count = new BehaviorSubject<number | undefined>(undefined) -    protected totalDonations = new BehaviorSubject<number | undefined>(undefined) +    protected totalDonations = new BehaviorSubject<String | undefined>(undefined)      protected totalNeeds = new BehaviorSubject<number | undefined>(undefined)      protected fulfilledNeeds = new BehaviorSubject<Need[] | undefined>(undefined)      protected mostFulfilledNeeds = new BehaviorSubject<Need[] | undefined>(undefined) +    protected physicalTotal: string[] = []      constructor(          protected authService: AuthService, @@ -30,15 +31,20 @@ export class DashboardComponent implements OnInit{      ngOnInit() {          this.userService.getCount().subscribe(count => this.count.next(count)) +        this.physicalTotal = []          this.cupboardService.getNeeds().subscribe(needs => {              let totalValue = 0              for (let need of needs) {                  if (need.type === GoalType.MONETARY) {                      totalValue += need.current -                    this.totalDonations.next(totalValue) +                    this.totalDonations.next(totalValue.toLocaleString()) +                } else { +                    this.physicalTotal.push(need.name + ": " + need.current)                  }              } + +            this.physicalTotal.sort((a, b) => a < b ? -1 : 1);              this.fulfilledNeeds.next(needs.filter(a => ((a.current / a.maxGoal)) >= 1))              needs.sort((a, b) => b.current/b.maxGoal - a.current/a.maxGoal)  | 
