aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkash Keshav <112591754+domesticchores@users.noreply.github.com>2025-03-17 22:58:15 -0400
committerGitHub <noreply@github.com>2025-03-17 22:58:15 -0400
commit49b1dab1d6619515e270944dee6efb4eb3cde4df (patch)
treec148b5e8c834ee3aa07e68280976719861387885
parente9950afde68bb6e5e659ac182334bf2b18088f90 (diff)
parentb5797b53eddf5a52ea9bbd8f3c638edd678407ab (diff)
downloadJellySolutions-49b1dab1d6619515e270944dee6efb4eb3cde4df.tar.gz
JellySolutions-49b1dab1d6619515e270944dee6efb4eb3cde4df.tar.bz2
JellySolutions-49b1dab1d6619515e270944dee6efb4eb3cde4df.zip
Merge pull request #12 from RIT-SWEN-261-02/need-page-rework-rework
Need page rework rework -> main pull request
-rw-r--r--ufund-api/data/cupboard.json2
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java2
-rw-r--r--ufund-ui/src/app/components/need-page/need-page.component.html29
-rw-r--r--ufund-ui/src/app/components/need-page/need-page.component.ts7
4 files changed, 28 insertions, 12 deletions
diff --git a/ufund-api/data/cupboard.json b/ufund-api/data/cupboard.json
index cc85335..abc2293 100644
--- a/ufund-api/data/cupboard.json
+++ b/ufund-api/data/cupboard.json
@@ -1 +1 @@
-[{"name":"Jellyfish Hats","id":26,"maxGoal":10.0,"type":"MONETARY","filterAttributes":[],"Current":0.0},{"name":"Pollution Re-Filtering","id":27,"maxGoal":1.0E7,"type":"MONETARY","filterAttributes":[],"Current":0.0},{"name":"Coral re-re-habilitation","id":28,"maxGoal":10000.0,"type":"MONETARY","filterAttributes":[],"Current":0.0}] \ No newline at end of file
+[{"name":"Jellyfish Hats","id":26,"maxGoal":10.0,"type":"MONETARY","filterAttributes":["#savethejellyfish","Clothing","Storefront"],"current":0.0},{"name":"Pollution Re-Filtering","id":27,"maxGoal":1.0E7,"type":"MONETARY","filterAttributes":["Cleanup","Donations","Third-Party"],"current":0.0},{"name":"Coral re-re-habilitation","id":28,"maxGoal":10000.0,"type":"MONETARY","filterAttributes":["Preservation","#savethecoral","#helloPhil"],"current":0.0}] \ No newline at end of file
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java
index 9ca097a..c0e9214 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java
@@ -14,7 +14,7 @@ public class Need {
@JsonProperty("filterAttributes") private String[] filterAttributes;
@JsonProperty("type") final private GoalType type;
@JsonProperty("maxGoal") private double maxGoal;
- @JsonProperty("Current") private double current;
+ @JsonProperty("current") private double current;
/**
* Create a new need
diff --git a/ufund-ui/src/app/components/need-page/need-page.component.html b/ufund-ui/src/app/components/need-page/need-page.component.html
index 4bb001e..8234ac7 100644
--- a/ufund-ui/src/app/components/need-page/need-page.component.html
+++ b/ufund-ui/src/app/components/need-page/need-page.component.html
@@ -1,8 +1,21 @@
-<input type="button" value="Back" (click)="back()">
-<h1>Need page</h1>
-<p>id: {{need?.id}}</p>
-<p>name: {{need?.name}}</p>
-<p>filterAttributes: {{need?.filterAttributes}}</p>
-<p>type: {{need?.type}}</p>
-<p>max goal: {{need?.maxGoal}}</p>
-<p>current: {{need?.maxGoal}}</p> \ No newline at end of file
+<h1>Viewing Need: {{need?.name}}</h1>
+<a>internal id: {{need?.id}}</a>
+<div style="display: flex; column-gap: 6px;">
+ <h3>Looking for</h3>
+ <h3><u>{{need?.type}}</u></h3>
+ <h3>Donations.</h3>
+</div>
+<div *ngIf="need?.filterAttributes != null">
+ <p>Tags:</p>
+ <ul style="display: flex; column-gap: 24px;">
+ <li *ngFor="let tag of need?.filterAttributes">
+ <p>{{tag}}</p>
+ </li>
+ </ul>
+</div>
+
+<hr>
+
+<p>Goal: {{need?.maxGoal}}</p>
+<p>Current: {{need?.current}}</p>
+<p>This goal is <strong>{{((need?.current ?? 0)*100) / (need?.maxGoal ?? 0)}}%</strong> complete!</p> \ No newline at end of file
diff --git a/ufund-ui/src/app/components/need-page/need-page.component.ts b/ufund-ui/src/app/components/need-page/need-page.component.ts
index 0673f86..597d0e0 100644
--- a/ufund-ui/src/app/components/need-page/need-page.component.ts
+++ b/ufund-ui/src/app/components/need-page/need-page.component.ts
@@ -1,7 +1,8 @@
import {Component, Input} from '@angular/core';
-import {Need} from '../../models/Need';
+import {GoalType, Need} from '../../models/Need';
import {ActivatedRoute} from "@angular/router";
import {CupboardService} from "../../services/cupboard.service";
+import { NgFor } from '@angular/common';
@Component({
selector: 'app-need-page',
@@ -15,6 +16,8 @@ export class NeedPageComponent {
private cupboardService: CupboardService,
) {}
+ public GoalType = GoalType;
+
@Input() need?: Need;
ngOnInit(): void {
@@ -25,4 +28,4 @@ export class NeedPageComponent {
back() {
window.history.back();
}
-}
+} \ No newline at end of file