diff options
Diffstat (limited to 'ufund-ui/src/app/components/dashboard')
3 files changed, 26 insertions, 17 deletions
diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.css b/ufund-ui/src/app/components/dashboard/dashboard.component.css index 185fdc2..742a151 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.css +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.css @@ -1,7 +1,11 @@  :host {      display: flex; -    flex-direction: column; +    justify-content: center; +} + +#box { +    display: flex;      width: 800px; -    align-self: center; -    gap: 20px +    flex-direction: column; +    gap: 10px;  } diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.html b/ufund-ui/src/app/components/dashboard/dashboard.component.html index 2af467c..074ca76 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.html +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.html @@ -1,14 +1,17 @@ - -<h1>Admin Dashboard</h1> -<!--<app-mini-need-list [needList]="topNeeds" jtitle="Top needs" url="/cupboard"/>--> -<!--<app-mini-need-list [needList]="almostThere" jtitle="Almost there" url="/cupboard"/>--> -<!--<app-mini-need-list [needList]="inBasket" jtitle="In your basket" url="/basket"/>--> -<span>_ Registered users</span> -<span *ngIf="count"> {{count | async}} </span> -<span>_ Fulfilled needs</span> -<app-mini-need-list [needList]="fulfilledNeeds.getValue()" jtitle="Fulfilled needs"> </app-mini-need-list> -<span>_ Most fulfilled needs</span> -<app-mini-need-list [needList]="mostFulfilledNeeds.getValue()" jtitle="Most fulfilled"> </app-mini-need-list> -<span>_ Total monetary contributions</span> -<span *ngIf="totalDonations">${{totalDonations | async}} </span> -<span>_ </span> +<div id="box"> +    @if ((authService.getCurrentUserSubject() | async)?.type === userType.MANAGER) { +        <h1>Admin Dashboard</h1> +        <span>_ Registered users</span> +        <span *ngIf="count"> {{count | async}} </span> +        <span>_ Fulfilled needs</span> +        <app-mini-need-list [needList]="fulfilledNeeds.getValue()" label="Fulfilled needs"> </app-mini-need-list> +        <span>_ Most fulfilled needs</span> +        <app-mini-need-list [needList]="mostFulfilledNeeds.getValue()" label="Most fulfilled"> </app-mini-need-list> +        <span>_ Total monetary contributions</span> +        <span *ngIf="totalDonations">${{totalDonations | async}} </span> +        <span>_ </span> +    } @else { +        <h1>Unauthorized</h1> +        <span>This page requires you to be logged in as an admin! <a routerLink="/login">Log In</a></span> +    } +</div> diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.ts index 9bf7627..1181608 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.ts +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.ts @@ -5,6 +5,7 @@ import {CupboardService} from '../../services/cupboard.service';  import {UsersService} from '../../services/users.service';  import {BehaviorSubject} from 'rxjs';  import {GoalType, Need} from '../../models/Need'; +import {userType} from '../../models/User';  @Component({      selector: 'app-dashboard', @@ -55,4 +56,5 @@ export class DashboardComponent implements OnInit{      } +    protected readonly userType = userType;  }  | 
