From 61b5b762b150c82e7d48190bcfe3416bfea96059 Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 29 Mar 2025 14:37:57 -0400 Subject: frontend implementation of a needs' urgency and location --- ufund-ui/src/app/components/cupboard/cupboard.component.html | 9 +++++++++ ufund-ui/src/app/components/cupboard/cupboard.component.ts | 8 +++++++- ufund-ui/src/app/components/need-list/need-list.component.ts | 12 ++++++------ ufund-ui/src/app/models/Need.ts | 2 ++ 4 files changed, 24 insertions(+), 7 deletions(-) (limited to 'ufund-ui/src') 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 @@


+
+



@@ -20,7 +22,10 @@

+ +
+
{{statusText | async}} @@ -30,6 +35,7 @@

+



@@ -37,7 +43,10 @@

+ +
+
{{statusText | async}} 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(); 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 { -- cgit v1.2.3