diff options
author | benal01 <bja4245@rit.edu> | 2025-03-29 14:37:57 -0400 |
---|---|---|
committer | benal01 <bja4245@rit.edu> | 2025-03-29 14:37:57 -0400 |
commit | 61b5b762b150c82e7d48190bcfe3416bfea96059 (patch) | |
tree | 1888d1036f5d82db32ba01f3566fd708dfc6fa02 /ufund-ui/src | |
parent | 9e011d85fd307768f7cec7214ca873208574ecfb (diff) | |
download | JellySolutions-61b5b762b150c82e7d48190bcfe3416bfea96059.tar.gz JellySolutions-61b5b762b150c82e7d48190bcfe3416bfea96059.tar.bz2 JellySolutions-61b5b762b150c82e7d48190bcfe3416bfea96059.zip |
frontend implementation of a needs' urgency and location
Diffstat (limited to 'ufund-ui/src')
4 files changed, 24 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 d54eed9..bc5ac1c 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -13,6 +13,8 @@ <form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)"> <label>Name:</label><br> <input type="text" name="name" 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> @@ -20,7 +22,10 @@ <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> <input type="submit" value="Submit"> + </form> <span *ngIf="statusText">{{statusText | async}}</span> @@ -30,6 +35,7 @@ <label>Needs:</label><br> <form #updateForm="ngForm" (ngSubmit)="update(updateForm.value)"> <input type="text" name="name" [(ngModel)]="selectedNeed.name"><br> + <input type="text" name="location" [(ngModel)]="selectedNeed.location"><br> <label>Max Goal:</label><br> <input type="number" name="maxGoal" [(ngModel)]="selectedNeed.maxGoal"><br> <label>Type</label><br> @@ -37,7 +43,10 @@ <label>Monetary</label><br> <input type="radio" name="type" value="PHYSICAL" [(ngModel)]="selectedNeed.type"> <label>Physical</label><br> + <input type="checkbox" name="urgent" [(ngModel)]="selectedNeed.urgent"> + <label>Urgent</label> <br> <input type="submit" value="Submit"> + </form> <span *ngIf="statusText">{{statusText | async}}</span> diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index a8b9c14..540a058 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -32,9 +32,11 @@ export class CupboardComponent implements OnInit { selectedNeed: any = { name: '', + location:'', id: null, maxGoal: null, - type: '' + type: '', + urgent: false }; selectedNeedId: number | null = null; searchResults: any[] = []; @@ -79,9 +81,11 @@ export class CupboardComponent implements OnInit { console.log(form); const need: Need = { name: form.name, + location: form.location, id: this.selectedNeed.id, //system will control this maxGoal: form.maxGoal, type: GoalType[form.type as keyof typeof GoalType], + urgent: form.urgent, filterAttributes: [], current: 0 }; @@ -113,9 +117,11 @@ export class CupboardComponent implements OnInit { submit(form: any) { const need: Need = { name: form.name, + location: form.location, id: 0, maxGoal: form.maxGoal, type: form.type, + urgent: form.urgent, filterAttributes: [], current: 0 }; diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 4359cfa..37a3775 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,5 +1,4 @@ -import {Component, input, Output, EventEmitter} from '@angular/core'; -import { NgForm } from '@angular/forms'; +import {Component , Output, EventEmitter} from '@angular/core'; import {Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; import { UsersService } from '../../services/users.service'; @@ -39,12 +38,13 @@ export class NeedListComponent { searchResults: Need[] = []; sortMode = 'Ascending' - currentSortAlgo: sortAlgo = sortByGoal; - sortSelection: string = 'sortByGoal'; + currentSortAlgo: sortAlgo = sortByName; + sortSelection: string = 'sortByName'; SortingAlgoArrays: {func:sortAlgo,name:string, display:string[]}[] = [ - {func:sortByGoal,name:"sortByGoal", display:["Maximum Goal", "Minimum Goal"]}, - {func:sortByName,name:"sortByName", display:["Name", "Name (Descending)"]}, + {func:sortByName,name:"sortByName", display:["Name (Alphabetical)", "Name (Reverse)"]}, + {func:sortByGoal,name:"sortByGoal", display:["Largest Maximum Goal", "Smallest Maximum Goal"]}, + {func:sortByName,name:"sortByPriority", display:["Highest Priority", "Lowest Priority"]}, ]; @Output() currentNeed = new EventEmitter<Need>(); diff --git a/ufund-ui/src/app/models/Need.ts b/ufund-ui/src/app/models/Need.ts index 9e97fd4..de6504a 100644 --- a/ufund-ui/src/app/models/Need.ts +++ b/ufund-ui/src/app/models/Need.ts @@ -2,9 +2,11 @@ export interface Need { name: string, id: number, filterAttributes: string[], + location: string; type: GoalType; maxGoal: number; current: number; + urgent: boolean; } export enum GoalType { |