aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/cupboard
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/components/cupboard')
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.html10
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.ts15
2 files changed, 5 insertions, 20 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html
index 3873719..cd8fec2 100644
--- a/ufund-ui/src/app/components/cupboard/cupboard.component.html
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html
@@ -4,7 +4,7 @@
<ng-template #create>
<app-need-edit [mode]="'Create'" (refreshNeedList)="refresh()"></app-need-edit>
</ng-template>
- <button *ngIf="isManager()" class="button2" (click)="modalService.showModal(create)"><span class="icon">add</span>Create Need</button>
+ <button *ngIf="usersService.isManager()" class="button2" (click)="modalService.showModal(create)"><span class="icon">add</span>Create Need</button>
</div>
<div id="header2">
@@ -33,16 +33,16 @@
<h2 *ngIf="searchResults.length == 0"> No Results Found </h2>
<ng-template let-need #NLActions>
- <button *ngIf="isHelper()" (click)="addToBasket(need)" [disabled]="inBasket(usersService.getBasket() | async, need)">
- <span class="icon">{{inBasket(usersService.getBasket() | async, need)? "check": "add" }}</span>Add To Basket
+ <button *ngIf="usersService.isHelper()" (click)="addToBasket(need)" [disabled]="usersService.inBasket(usersService.getBasket() | async, need)">
+ <span class="icon">{{usersService.inBasket(usersService.getBasket() | async, need)? "check": "add" }}</span>Add To Basket
</button>
<ng-template #edit>
<app-need-edit *ngIf="need" [mode]="'Edit'" [need]="need" (refreshNeedList)="refresh()"></app-need-edit>
</ng-template>
- <button *ngIf="isManager()" (click)="modalService.showModal(edit)">
+ <button *ngIf="usersService.isManager()" (click)="modalService.showModal(edit)">
<span class="icon">edit</span>Edit Need
</button>
- <button *ngIf="isManager()" (click)="deleteNeed(need.id)" >
+ <button *ngIf="usersService.isManager()" (click)="deleteNeed(need.id)" >
<span class="icon">delete</span>Delete Need
</button>
</ng-template>
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts
index 56fdd70..289618f 100644
--- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts
@@ -1,7 +1,6 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {CupboardService} from '../../services/cupboard.service';
import {Need} from '../../models/Need';
-import {userType} from '../../models/User';
import {catchError, of} from 'rxjs';
import {NeedListComponent} from '../need-list/need-list.component';
import {AuthService} from '../../services/auth.service';
@@ -138,20 +137,6 @@ export class CupboardComponent implements OnInit {
}
}
- isManager() {
- return this.authService.getCurrentUser()?.type === userType.MANAGER
- }
-
- isHelper() {
- return this.authService.getCurrentUser()?.type === userType.HELPER
- }
-
- inBasket(basket: Need[] | null, need: Need) {
- console.log(basket)
- console.log(need)
- return basket?.map(r => r.id).includes(need.id);
- }
-
protected readonly SortingAlgorithms = SortingAlgoArrays;
protected readonly Object = Object;
}