aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/cupboard/cupboard.component.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.html82
1 files changed, 35 insertions, 47 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html
index 0d64475..37954bb 100644
--- a/ufund-ui/src/app/components/cupboard/cupboard.component.html
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html
@@ -1,50 +1,38 @@
-<h1> Cupboard </h1>
-<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 id="box">
+ <div id="header">
+ <h1> Cupboard </h1>
+ <button *ngIf="isManager()" class="button2" (click)="this.selectForm('create')"><span class="icon">add</span>Create Need</button>
+ </div>
+ <app-need-list (currentNeed) = populateForm($event) #needList></app-need-list>
</div>
-<div id="create-form">
- <h1> Create a new need </h1>
- <form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)">
- <label>Name:</label><br>
- <input type="text" name="name" ngModel><br>
- <label>Max Goal:</label><br>
- <input type="number" name="maxGoal" ngModel><br>
- <label>Type</label><br>
- <input type="radio" name="type" value="MONETARY" ngModel>
- <label>Monetary</label><br>
- <input type="radio" name="type" value="PHYSICAL" ngModel>
- <label>Physical</label><br>
- <input type="submit" value="Submit">
- </form>
- <button (click)="back()">Close</button>
- <span *ngIf="statusText">‼️{{statusText | async}}</span>
+<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>
+ <form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)">
+ <label>Name:</label><br>
+ <input type="text" name="name" ngModel><br>
+ <label>Image:</label><br>
+ <input type="text" name="image" ngModel><br>
+ <label>Location:</label><br>
+ <input type="text" name="location" ngModel><br>
+ <label>Max Goal:</label><br>
+ <input type="number" name="maxGoal" ngModel><br>
+ <label>Type</label><br>
+ <input type="radio" name="type" value="MONETARY" ngModel>
+ <label>Monetary</label><br>
+ <input type="radio" name="type" value="PHYSICAL" ngModel>
+ <label>Physical</label><br>
+ <input type="checkbox" name="urgent" value="false" ngModel>
+ <label>Urgent</label><br>
+ <label>Description</label><br>
+ <textarea name="description"></textarea><br>
+ <input type="submit" value="Submit">
+ </form>
+ </div>
+ </div>
</div>
-<div id="update-form">
- <h1> Update a need </h1>
- <label>Needs:</label><br>
- <form #updateForm="ngForm" (ngSubmit)="update(updateForm.value)">
- <div *ngFor="let need of needs">
-
- <input type="radio" name="id" [value]=need.id [(ngModel)]="selectedNeedId" (change)="populateForm(need)">
- <label name="template">{{need.name}}</label><br>
- </div>
- <label>Name:</label><br>
- <input type="text" name="name" [(ngModel)]="selectedNeed.name"><br>
- <label>Max Goal:</label><br>
- <input type="number" name="maxGoal" [(ngModel)]="selectedNeed.maxGoal"><br>
- <label>Type</label><br>
- <input type="radio" name="type" value="MONETARY" [(ngModel)]="selectedNeed.type">
- <label>Monetary</label><br>
- <input type="radio" name="type" value="PHYSICAL" [(ngModel)]="selectedNeed.type">
- <label>Physical</label><br>
- <input type="submit" value="Submit">
- </form>
- <button (click)="back()">Close</button>
- <span *ngIf="statusText">{{statusText | async}}</span>
-
-</div>
-<hr>
-<app-need-list #needList></app-need-list>
+</ng-template>