diff options
Diffstat (limited to 'ufund-ui/src/app/components/cupboard')
-rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.html | 8 | ||||
-rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.ts | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 71c258e..5e88582 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -33,7 +33,10 @@ <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> - <button *ngIf="isManager()" (click)="select(need)"> + <ng-template #edit> + <app-need-edit *ngIf="need" [selectedNeed]="need" (refreshNeedList)="refresh()"></app-need-edit> + </ng-template> + <button *ngIf="isManager()" (click)="modalService.showModal(edit)"> <span class="icon">edit</span>Edit Need </button> <button *ngIf="isManager()" (click)="deleteNeed(need.id)" > @@ -43,9 +46,7 @@ <app-need-list [actionArea]="NLActions" *ngIf="searchResults.length > 0" [needs]="searchResults" [itemsPerPage]="itemsPerPage" #needList/> </div> -<!--<ng-template [ngIf]="isManager()" >--> <!--<div>--> -<!-- <app-need-edit *ngIf="selectedForm === 'update'" [selectedNeed]="selectedNeed" (refreshNeedList)="needList.refresh()"></app-need-edit>--> <!-- <div>--> <!-- <div id="create-form" *ngIf="selectedForm === 'create'">--> <!-- <h1> Create Need </h1>--> @@ -73,4 +74,3 @@ <!-- </div>--> <!-- </div>--> <!--</div>--> -<!--</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 bde8e27..f5e4c00 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -9,6 +9,7 @@ import {ToastsService, ToastType} from '../../services/toasts.service'; import {UsersService} from '../../services/users.service'; import {SortingAlgoArrays} from './sorting'; import {Router} from '@angular/router'; +import {ModalService} from '../../services/modal.service'; @Component({ selector: 'app-cupboard', @@ -29,13 +30,15 @@ export class CupboardComponent implements OnInit { sortMode: 'Ascending' | 'Descending' = 'Ascending' itemsPerPage = 5; currentSortAlgo = 'sortByPriority'; + // activeEdit?: Need; constructor( private cupboardService: CupboardService, private authService: AuthService, private toastService: ToastsService, protected usersService: UsersService, - private router: Router + private router: Router, + protected modalService: ModalService ) {} ngOnInit(): void { @@ -149,6 +152,10 @@ export class CupboardComponent implements OnInit { return basket?.map(r => r.id).includes(need.id); } + // editNeed(need : Need) { + // this.activeEdit = need + // } + // --------------- FORM STUFF NOT IMPLEMENTED YET --------------- // // async updateSearchResults() { @@ -182,7 +189,7 @@ export class CupboardComponent implements OnInit { // this.selectedNeed = { ...need }; // } // - select(need : Need) { + // select(need : Need) { // //emit value // // this.currentNeed.emit(need); // if (this.selectedNeed) { @@ -212,7 +219,7 @@ export class CupboardComponent implements OnInit { // if (button) { // button.style.visibility = 'hidden'; // } - } + // } // submit(form: any) { // const need: Need = { |