diff options
Diffstat (limited to 'ufund-ui/src/app/components/cupboard')
| -rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.html | 3 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.ts | 9 | 
2 files changed, 9 insertions, 3 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 23aaec7..65545e8 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -1,5 +1,6 @@  <h1> Cupboard </h1> -<div id="menu"> +<h2 *ngIf="isManager()" > Admin View </h2> +<div id="menu" *ngIf="isManager()">      <button (click)="opencreate()">Create new Need</button>      <button (click)="openupdate()">Update existing Need</button>  </div> diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index b5726cf..5a8773d 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -1,7 +1,8 @@  import { Component, OnInit, ViewChild } from '@angular/core';  import { CupboardService } from '../../services/cupboard.service'; +import { UsersService } from '../../services/users.service';  import { Need, GoalType } from '../../models/Need'; -import { Form } from '@angular/forms'; +import { userType } from '../../models/User';   @Component({    selector: 'app-cupboard', @@ -12,7 +13,7 @@ import { Form } from '@angular/forms';  export class CupboardComponent implements OnInit {  needs: any; -    constructor(private cupboardService: CupboardService) { } +    constructor(private cupboardService: CupboardService, private usersService: UsersService) { }      ngOnInit(): void {        this.cupboardService.getNeeds().subscribe(n => this.needs = n); @@ -73,6 +74,10 @@ needs: any;        this.selectedNeed = { ...need };      } +    isManager() { +      return this.usersService.getCurrentUser()?.type == userType.MANAGER; +    } +      update(form: any) {        console.log(form);        const need: Need = {  | 
